00:00:09 | federico3 | thanks krux02 |
00:00:36 | Araq | You cannot blame escape for doing exactly what the documentation says, sorry, that's just silly |
00:01:03 | krux02 | well, the documentation say "many different common syntaxes" |
00:01:11 | Araq | and when you grow it new parameters, 'unescape' too needs to support that and it also needs to be documented and tested |
00:01:17 | krux02 | in my opinion that implies C code |
00:01:28 | krux02 | that is common enough for a language that emits C code |
00:02:00 | krux02 | It should mention what it actually can, and what it can't |
00:02:42 | krux02 | when the proc would be called shellEscape, I would not have used it |
00:03:14 | Araq | there you go, I improved the docs. |
00:03:16 | krux02 | same with the toUpper, that is now called toUpperAscii |
00:03:35 | krux02 | ok |
00:04:29 | Araq | yeah, toUpperAscii is also annoying me |
00:04:53 | krux02 | I can understand it |
00:05:28 | Araq | pointless change and verbose. I don't use toUpper for Unicode, that's wrong |
00:05:42 | krux02 | but it is a better solution than letting people think it would work on non-ascii |
00:06:01 | Araq | you need a cmpAssumeGerman instead or something |
00:07:39 | krux02 | I understand that you don't like it, but that name really prevents bugs introduces by people who don't study the specification of everything before they start using things |
00:07:57 | krux02 | It clearly states it's limitations |
00:08:18 | krux02 | and nowadays strings are unicode by default, ASCII is a limitation |
00:08:36 | Araq | yeah we should have called it, escapeButNotValidForC, got it :P |
00:09:51 | Araq | unicode.toUpper vs strutils.toUpper doesn't prevent bugs IMO, unicode.toUpper is in itself a bug |
00:09:57 | krux02 | where did you use escape? |
00:10:17 | cheatfate | krux02, ascii is encoding not a limitation... also what unicode is default utf-8, utf-16, utf-32, utf-64? |
00:10:26 | * | nsf quit (Quit: WeeChat 1.7) |
00:10:45 | krux02 | well, you could also have renamed the modlue strutils to asciistrutils |
00:11:07 | krux02 | utf8 is default |
00:11:10 | krux02 | it's even here |
00:11:10 | Araq | he, I like that |
00:11:13 | krux02 | üöä |
00:11:22 | cheatfate | windows disagree with you utf-32 is default for windows |
00:11:24 | Araq | too bad strutils is everywhere |
00:11:55 | federico3 | (please let's not do the python2/python3 unicode mess again) |
00:14:58 | krux02 | Araq: well sed ftw |
00:23:07 | zachcarter | the commercial texturepacker program stores its project files as xml, definitely won’t be doing that |
00:38:36 | * | Nobabs27 joined #nim |
00:41:29 | zachcarter | o/ Nobabs27 welcome back |
00:41:42 | zachcarter | I tried to answer you last night but you left before I had a chance |
00:41:58 | Nobabs27 | haha thanks |
00:42:05 | Nobabs27 | cool, what was it? |
00:42:12 | zachcarter | tbh I don’t remember |
00:42:20 | zachcarter | I don’t even remember the question |
00:42:25 | Nobabs27 | sec ill copy and paste |
00:42:25 | zachcarter | let me go look back at the logs |
00:42:28 | zachcarter | okay |
00:42:30 | Nobabs27 | how would I use if lots of times? Like in if whatever == "ok" || whatever == "okay" |
00:42:34 | Nobabs27 | or even better test for the same var? |
00:42:37 | zachcarter | ah yes |
00:42:41 | zachcarter | a case statement I think |
00:43:00 | Nobabs27 | hm, k then |
00:43:02 | zachcarter | let me link you to the docu on it |
00:43:06 | Nobabs27 | kk |
00:43:17 | zachcarter | https://nim-lang.org/docs/tut1.html#control-flow-statements-case-statement |
00:43:28 | zachcarter | if that’s not going to handle your use case let me know |
00:43:49 | Nobabs27 | ok, ty again lol |
00:43:49 | zachcarter | but it’s more efficient than a bunch of if-elses |
00:43:54 | Nobabs27 | yeah |
00:43:58 | zachcarter | in programming it’s generally the way to handle that kind of scenario |
00:44:04 | zachcarter | in some languages they’re referred to as switch statements |
00:44:12 | zachcarter | np |
00:52:32 | * | themagician_g quit () |
00:53:28 | PMunch | Hmm, Araq I'm trying to use libui. But how is one supposed to get values out of a Radiobox? |
00:53:40 | * | brson quit (Ping timeout: 268 seconds) |
00:53:41 | PMunch | It doesn't have a way to set an onupdate function |
00:54:15 | zachcarter | think he went to sleep |
00:54:22 | zachcarter | not 100% sure though |
00:54:23 | PMunch | Oh, okay |
00:54:46 | zachcarter | PMunch, not to deter you from using libui but did you see my nuklear bindings? |
00:55:09 | zachcarter | I’ve been using the library in a little test project I’m building for my game engine and so far it’s going swimmingly |
00:55:09 | PMunch | No |
00:55:15 | zachcarter | one sec let me link you |
00:55:23 | PMunch | What's the benefits of Nuklear? |
00:55:28 | zachcarter | https://github.com/zacharycarter/nuklear-nim |
00:55:44 | zachcarter | It’s a C immediate mode GUI library that supports whatever backend you want it to |
00:55:47 | PMunch | Ah, oh right |
00:55:50 | zachcarter | graphics backend |
00:55:55 | PMunch | I remember looking at it |
00:55:55 | zachcarter | not sure what your use case is though |
00:56:12 | PMunch | Would be nice for games, but I want libui for it's native look |
00:56:29 | zachcarter | gotcha |
00:56:49 | zachcarter | there’s nim-x too |
00:56:59 | zachcarter | but I don’t think it looks very native atm |
00:57:13 | PMunch | I know, I've considered that as well |
00:57:23 | zachcarter | :) done your homework |
00:57:25 | PMunch | My choice was pretty much between WxWidgets and libui |
00:57:56 | zachcarter | yeah I don’t know what the state of the libui stuff is… I know Araq invested time in it but I’ve also seen him rail against it |
00:58:08 | zachcarter | how’s it working for you? |
00:58:14 | zachcarter | besides the radio button thing? |
00:58:24 | PMunch | It's really nice actually |
00:58:35 | PMunch | Wrote a macro for it so I can create GUIs more intuitively |
00:58:53 | PMunch | http://ix.io/nMz |
00:58:57 | PMunch | That's a code snippet |
00:59:06 | PMunch | genui: is the macro |
00:59:13 | zachcarter | that is nice |
00:59:22 | PMunch | It transforms the DSL below into code that creates a UI |
00:59:31 | zachcarter | right |
00:59:55 | PMunch | Arguments in () is passed to the functions creator, and arguments in [] is passed to the add function when it's added to it's parent |
01:00:50 | PMunch | You can use the syntax <identifier>%Widget to create a var <identifier> = widget statement in the resulting code so you can easily use them later and you can use %<identifier> to add a widget stored in a variable |
01:00:58 | zachcarter | not sure I get that last bit completely |
01:01:05 | zachcarter | so what does Button(“Button”) do exactly |
01:01:11 | zachcarter | adds a button to the vertical box |
01:01:24 | zachcarter | or whatever parent widget is specified |
01:01:36 | zachcarter | but why the “Button” arg |
01:01:43 | PMunch | Button("Button") turns into "let tmp2020232 = newButton("Button"); add(parent,tmp2020232)" |
01:01:58 | PMunch | "Button" is just the text displayed on the button :) |
01:01:59 | zachcarter | oh the button is named button okay |
01:02:06 | zachcarter | cool :D |
01:02:13 | PMunch | Button("This is a button") |
01:02:14 | zachcarter | yeah it’s much nicer than my code atm |
01:02:26 | PMunch | That would create a Button which said "This is a button" |
01:02:36 | zachcarter | right |
01:02:37 | zachcarter | https://gist.github.com/zacharycarter/bf5a640fe52c6fe2ed85c95775b10d1f |
01:02:43 | zachcarter | that’s the code for my filebrowser |
01:02:44 | PMunch | If you need a reference to the button later you could do mybutton%Button("This is a button") |
01:03:01 | PMunch | And that would make mybutton a var of type Button which can be used later in your cade |
01:03:23 | zachcarter | right |
01:03:25 | PMunch | You can see this be used in the getRadioBox function where it does result%RadioButtons |
01:03:38 | PMunch | That assign RadioButtons to the result variable |
01:03:51 | zachcarter | ah result yeah |
01:03:52 | zachcarter | okay |
01:03:53 | PMunch | And later in main it is added into the tree with %rb |
01:04:11 | PMunch | After, of course, the call var rb = getRadioBox() |
01:04:22 | zachcarter | yeah just saw that |
01:04:23 | zachcarter | nice |
01:04:28 | zachcarter | very cool little DSL |
01:04:32 | PMunch | Thanks :) |
01:04:44 | PMunch | It's one of those things which have always annoyed me with GUIs |
01:05:12 | zachcarter | yeah I hate writing them |
01:05:30 | PMunch | The code to create them never looks good and it's filled with cryptic variable names since the programmer can't be bothered to create actual names for things that will never be used. |
01:05:37 | zachcarter | right |
01:06:19 | PMunch | One of the most annoying parts of writing the macro was actually going back and forth with Araqs "controllgallery" example and porting the old GUI code over |
01:06:54 | PMunch | Just recreating that simple GUI was hard since it's a mess of random variables and UI functions (as all UI code is) |
01:07:07 | zachcarter | yeah |
01:07:17 | zachcarter | imediate mode simplifies some of this stuff a little bit but not much |
01:07:25 | zachcarter | less state to maintain |
01:07:33 | PMunch | Oh yeah, that's for sure |
01:07:34 | zachcarter | but still a lot of state when you’re building something complex |
01:07:42 | PMunch | The FileBrowser looks nice by the way :) |
01:07:46 | zachcarter | thank you :) |
01:08:23 | zachcarter | currently I’m building a little texture packer app to test out nuklear with my game endgine |
01:08:25 | zachcarter | engine* |
01:08:37 | zachcarter | since I’ll need a way to pack sprites for my game anyway |
01:08:38 | PMunch | Oh nice |
01:08:58 | zachcarter | what are you building? |
01:09:00 | PMunch | I have some Nim code to grab textures from a TexturePacker texture atlas |
01:09:11 | PMunch | The kind used by LibGdx |
01:09:21 | PMunch | Supports all kinds of rotations, animations etc. |
01:09:31 | zachcarter | nice :) Yeah I”m going to rip a lot of code from the libgdx texture packer I imagine |
01:09:44 | zachcarter | for max rect and bin packing etc |
01:10:10 | PMunch | Currently I'm not building anything in particular. I've got a game on the back burner but right now I'm just writing this UI thing for it's own sake |
01:10:13 | zachcarter | alot of my engine is inspried by libgdx |
01:10:19 | zachcarter | ah okay nice |
01:10:24 | PMunch | LibGDX is nice |
01:10:27 | zachcarter | it is |
01:10:38 | zachcarter | here’s some example code from a little 2d test of my engine : |
01:11:17 | zachcarter | https://gist.github.com/zacharycarter/3523bbcf04185d86546238244b9a4ad3 |
01:11:23 | PMunch | I wrote a little "game library" not an engine per say. It tries to be as versatile as possible |
01:11:33 | * | def-pri-pub quit (Ping timeout: 260 seconds) |
01:12:04 | zachcarter | is it on github? |
01:12:22 | PMunch | Uhm, an early version is |
01:12:25 | PMunch | Hold on |
01:12:51 | * | def-pri-pub joined #nim |
01:13:59 | PMunch | https://github.com/PMunch/SDLGamelib |
01:14:02 | PMunch | That seems to be it |
01:14:12 | PMunch | It uses SDL as it's rendering frontend |
01:14:36 | zachcarter | cool |
01:14:49 | zachcarter | I’m using https://github.com/bkaradzic/bgfx |
01:14:57 | zachcarter | for rendering |
01:15:04 | PMunch | https://github.com/PMunch/nim-sdl-template |
01:15:14 | PMunch | That's the reason why it's using SDL |
01:15:20 | PMunch | It was started from that project |
01:15:34 | zachcarter | ah okay yeah I’ve seen that project before |
01:15:35 | PMunch | Cross platform Nim on Android, iOS, and desktop |
01:15:41 | zachcarter | right |
01:15:47 | PMunch | And it all runs on SDL |
01:15:56 | zachcarter | yeah I’m using glfw3 for my windowing code |
01:16:21 | PMunch | If you look in the src folder of the nim-sdl-template you can see the gamelib |
01:16:24 | PMunch | But an older version |
01:16:58 | zachcarter | so one thing about the SDL renderer which is a reason I wanted to avoid it |
01:17:02 | krux02 | PMunch: do you know that SDL has big performance problems when you use the rendering primitives? |
01:17:11 | zachcarter | it doesn’t do draw batching |
01:17:27 | PMunch | krux02, no I didn't |
01:17:32 | PMunch | Any articles on it? |
01:17:41 | zachcarter | one sec |
01:17:42 | krux02 | no I just looked at the code |
01:17:51 | zachcarter | http://gamedev.stackexchange.com/questions/70876/sdl2-sprite-batching-and-texture-atlases |
01:17:53 | krux02 | It draws everything directly |
01:18:11 | krux02 | every call is a draw call on the GPU |
01:18:21 | zachcarter | whoops sorry that’s a bad link |
01:18:36 | PMunch | Ooh, that's not good |
01:18:37 | krux02 | I actually did a benchmark on my laptop (bad GPU) |
01:19:00 | krux02 | and there I had a performance increase with a factor of at least 10, when I did software rendering |
01:19:22 | zachcarter | that’s why if you want performance out of SDL2 you have to use raw opengl |
01:19:22 | krux02 | All I did was a simple tile rendering, with one draw call per tile |
01:19:26 | zachcarter | and write your own drawing code |
01:20:10 | krux02 | sdl for drawing is only feasible, when you have big surfaces you draw from |
01:20:17 | PMunch | Hmm, I'll have to look into this |
01:20:22 | krux02 | when you have many small pieces, it is very slow |
01:20:33 | krux02 | you can't really do particles |
01:20:34 | PMunch | Ah, so if you use texture atlases then you are fine? |
01:20:36 | zachcarter | PMunch that’s why libraries like - https://github.com/grimfang4/sdl-gpu exist |
01:20:44 | zachcarter | no unfortunately not |
01:20:54 | zachcarter | so PMunch here’s an example of a sprite batch I wrote |
01:21:14 | zachcarter | https://gist.github.com/zacharycarter/2b8d8f3a997ac08ef7d576dc15f8b031 |
01:21:20 | zachcarter | it’s a bit complicated with all the bgfx calls |
01:21:25 | krux02 | if sdl would have support for a batch renderer, then texture atlas would be the way to go |
01:21:42 | krux02 | but there is no method for "render this list of rectangles" |
01:21:46 | zachcarter | but the important thing to note is it stores vertices and doesn’t submit a draw call until a certain number of vertices are held in memory |
01:21:56 | zachcarter | OR the texture that needs to be rendered changes |
01:22:03 | zachcarter | and when that happens the batch is flushed and a draw call is submitted |
01:22:09 | krux02 | you have to do a loop, and that is slow |
01:22:10 | PMunch | http://gamedev.stackexchange.com/questions/70876/sdl2-sprite-batching-and-texture-atlases |
01:22:15 | zachcarter | SDL doesn’t do anything like this under the hood |
01:22:21 | * | ludocode quit (Read error: Connection reset by peer) |
01:22:49 | PMunch | Well according to that SDL will wait with your copy commands until you want to present the result so you would get benefits from texture packing.. |
01:22:57 | PMunch | Is the poster there wrong? |
01:23:03 | krux02 | yes that's exactly the command it lacks |
01:23:11 | krux02 | I was also looking for something like that |
01:23:31 | PMunch | But look at the top answer |
01:23:41 | zachcarter | yeah he says in it |
01:23:47 | zachcarter | SDL2 certainly could offer something similar to XNA's SpriteBatch. You can already do that today on your own, though, so it's hardly necessary for SDL2 to do it in order for you to obtain the best performance. |
01:24:10 | zachcarter | xna / libgdx / whatever framework has a sprite batch |
01:24:48 | krux02 | I took a look at the opengl implementation, I did not see any batching |
01:25:10 | zachcarter | there’s definitely not krux02 |
01:25:50 | zachcarter | https://www.reddit.com/r/gamedev/comments/3y1va8/sdl2_c_tile_map_most_efficient_way_to_render_lots/ |
01:25:52 | zachcarter | first answer there |
01:26:07 | krux02 | It is not that I don't like SDL, I really do like SDL and I use it for all of my projects, but there are features in it, that are rather useless, and should be avoided |
01:26:14 | krux02 | the 2D rendering api is one of them |
01:26:23 | zachcarter | It’s fine for certain things |
01:26:24 | PMunch | Hmm |
01:26:39 | zachcarter | but again there’s a reason projects like - https://github.com/grimfang4/sdl-gpu exist |
01:26:49 | krux02 | the software surface blitting is good to create a texture atlas, but rendering should be done in OpenGl |
01:26:49 | PMunch | Yeah |
01:26:52 | zachcarter | PMunch : even listed in the features there is sprite batching |
01:28:07 | PMunch | Thanks for making me aware of this. I'll certainly have to run some benchmarks |
01:28:28 | zachcarter | I tried to wrap sdl-gpu and failed, before I knew a lot about wrapping C libraries |
01:28:35 | zachcarter | I could give it another go if desired PMunch |
01:28:48 | PMunch | It would be helpful to have it certainly |
01:28:59 | PMunch | Both for me and others who wants to use SDL in Nim |
01:29:10 | zachcarter | alright next weekend I’m probably writing a “How to wrap C libraries with Nim” so maybe i’ll use that as an example project |
01:30:46 | zachcarter | assuming I can get it wrapped this time, but I think I should be able to |
01:30:53 | krux02 | I just created an issue for nim regarding C library wrappers |
01:31:02 | zachcarter | oh yeah? |
01:31:05 | krux02 | https://github.com/nim-lang/Nim/issues/5437 |
01:32:17 | zachcarter | that would be awsome |
01:32:29 | PMunch | Is there a guide on how to make a wrapper "nimian"? If not there should be |
01:33:30 | zachcarter | probably not |
01:33:38 | zachcarter | I’ve only really come across one or two guides about wrapping libraries with nim |
01:33:44 | zachcarter | neither were great |
01:34:04 | PMunch | I watched this talk: https://www.youtube.com/watch?v=wf-BqAjZb8M&t=1417s recently |
01:34:28 | PMunch | It's about what PEP-8 (Python style good) does to how you think about "good code" |
01:35:14 | PMunch | At ~23.37 he shows an example of how the above code (which was Python from a Java wrapper) could be done much more Pythonic |
01:35:29 | PMunch | But it required either a change in the library, or a thin wrapper. |
01:35:53 | zachcarter | yeah I think that might be guide # 2 |
01:36:03 | zachcarter | after I finish writing the first guide |
01:36:04 | PMunch | And I think this is something that Nim should keep in mind as well. Simply converting a C library to be usable in Nim might not be good enough |
01:36:24 | PMunch | It should also include things to make it more "nimian" |
01:36:26 | zachcarter | it’s true you can always make the bindings more idiomatic for the language you’re binding to |
01:36:33 | PMunch | Exactly |
01:36:46 | zachcarter | but first we need a guide about how to bind :D |
01:36:52 | PMunch | Haha, that's true :) |
01:36:57 | zachcarter | because the one that exists right now on the internet is pretty awful |
01:37:10 | zachcarter | it basically is a summary of the docu on #if C2NIM |
01:37:22 | libman | Nuklear is lightweight, permissively licensed, and has no dependencies. |
01:37:27 | krux02 | I think there are two levels that are very important |
01:37:40 | krux02 | The first level is the thinnest wrapper possible |
01:37:44 | krux02 | no conversion |
01:37:58 | PMunch | Oh yeah, for performance |
01:38:00 | krux02 | but all data from the C library and function calls should be available |
01:38:12 | krux02 | then there should be something that is a bit more in the style of Nim |
01:38:12 | zachcarter | libman: ? |
01:38:18 | PMunch | I've seen a lot of the Nim libraries diving things up with raw<lib> and lib |
01:38:33 | PMunch | libui is an example |
01:38:48 | krux02 | and the outer wrapper should not export any cint, c... types at all |
01:39:01 | PMunch | It has rawui which is basically just casting and such, then you have ui which makes in all pretty and Nim-like |
01:39:15 | krux02 | I remember, that I once have written A go wrapper, and the library returned a char* |
01:39:28 | krux02 | I just opened up the string header, und put the pointer in |
01:39:32 | krux02 | I did not do a conversion |
01:39:34 | krux02 | and it worked |
01:39:47 | krux02 | that's both, thin, and ideomatic |
01:40:01 | krux02 | the garbage collector also did not have a broblem with it |
01:40:28 | zachcarter | nice |
01:40:33 | zachcarter | I gotta run, be back later |
01:40:51 | krux02 | The problem is, that would not pe possible in Nim, because in Nim a string is the data directly followed after the size/capacity pair |
01:41:03 | libman | That was re PMunch "What's the benefits of Nuklear?" |
01:41:07 | krux02 | so there is no field, where I can write the pointer to |
01:41:55 | zachcarter | oh gotcha |
01:42:51 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
01:46:22 | PMunch | krux02, well the reason I think is UTF-8 |
01:46:29 | PMunch | Can't use null-terminated strings with it |
01:46:42 | PMunch | libman, haha that was ages ago |
01:46:48 | PMunch | zachcarter, told me |
01:46:56 | PMunch | What the benefits were :) |
01:46:59 | PMunch | But thanks anyways |
01:47:27 | krux02 | null-terminated strings just work fine with utf-8 |
01:50:25 | PMunch | Oh, you're right |
01:50:31 | PMunch | I thought that was the reason.. |
01:50:55 | PMunch | I guess it's to make strings more secure then |
01:51:05 | PMunch | And to much easier be able to get a len out of it |
01:53:18 | krux02 | Well the reason is probably just performance |
01:53:42 | krux02 | when you have the size and the capacity stored with the actual string data, the string itself can be implemented with just a pointer |
01:54:51 | krux02 | java also has a design, where the string has data and size stored together, and then the string is always referenced |
01:55:15 | krux02 | but nim strings are different, they are mutable with copy semantics, like c++ strings |
01:55:36 | krux02 | so I am not sure if these things actually make a difference |
01:56:39 | * | brson joined #nim |
01:57:54 | PMunch | Hmm |
02:29:33 | * | Matthias247 quit (Read error: Connection reset by peer) |
02:30:59 | * | chemist69 quit (Disconnected by services) |
02:31:03 | * | chemist69_ joined #nim |
02:33:39 | * | bjz joined #nim |
03:02:51 | * | jmkr joined #nim |
03:43:36 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
03:45:33 | * | rauce quit (Ping timeout: 260 seconds) |
03:52:57 | * | rauce joined #nim |
04:09:57 | Nobabs27 | Using paramStr(), else does not trigger when no args are given? |
04:17:05 | * | dddddd quit (Remote host closed the connection) |
04:22:59 | * | bjz joined #nim |
04:30:31 | zachcarter | Nobabs27 - let me take a look |
04:32:34 | * | Snircle_ joined #nim |
04:32:45 | zachcarter | how are you calling paramstr when no args are given Nobabs? Don’t you have to specify an index? |
04:32:55 | zachcarter | Nobabs27 * |
04:34:24 | * | chemist69_ quit (Ping timeout: 240 seconds) |
04:34:24 | * | Snircle quit (Ping timeout: 240 seconds) |
04:39:11 | * | chemist69 joined #nim |
04:43:45 | Nobabs27 | k sec |
04:44:04 | Nobabs27 | case paramStr(1) |
04:44:37 | Nobabs27 | actually |
04:44:57 | zachcarter | if I don’t provide an args and I do case paramStr(1) I get an error |
04:45:08 | zachcarter | index out of bounds |
04:45:14 | zachcarter | which makes sense… |
04:45:21 | Nobabs27 | yeah |
04:45:22 | Nobabs27 | that |
04:45:52 | zachcarter | so the reason for that is because argument 0 I believe is the application name or working directory or something |
04:46:00 | zachcarter | let me find out which |
04:46:06 | Nobabs27 | ok |
04:46:18 | Nobabs27 | why does it care what those are? |
04:46:35 | zachcarter | it’s the current binary name being executed |
04:46:41 | Nobabs27 | ok |
04:46:46 | Nobabs27 | in this case ./test |
04:46:55 | zachcarter | right |
04:47:08 | zachcarter | it will probably fully resolve the path ./ |
04:47:22 | zachcarter | but anywho it doesn’t care it just plops that in as the first argument in case you care |
04:47:39 | Nobabs27 | how do I stop it from plopping it? xD |
04:47:45 | zachcarter | you as the user of that function always know that the name of the executable will be at argument 0 |
04:47:48 | zachcarter | you can’t just ignore it |
04:47:54 | zachcarter | are you trying to iterate over command line arguments? |
04:47:59 | zachcarter | what exactly are you trying to do? |
04:48:18 | Nobabs27 | have it print something more sane |
04:48:28 | Nobabs27 | like "you didn't type anything, please do" |
04:48:39 | Nobabs27 | or "no args" |
04:48:46 | zachcarter | let me write something up for you real quick |
04:48:57 | Nobabs27 | gg ty |
04:50:17 | zachcarter | just fyi there is a great Nim library for parsing command line arguments |
04:50:27 | Nobabs27 | name? |
04:50:30 | zachcarter | https://github.com/docopt/docopt.nim |
04:54:09 | zachcarter | import parseopt2 |
04:54:10 | zachcarter | proc writeHelp() = |
04:54:12 | zachcarter | echo "help" |
04:54:13 | zachcarter | proc writeVersion() = |
04:54:15 | zachcarter | echo "version" |
04:54:16 | zachcarter | var |
04:54:18 | zachcarter | filename = "" |
04:54:19 | zachcarter | for kind, key, val in getopt(): |
04:54:21 | zachcarter | case kind |
04:54:22 | zachcarter | of cmdArgument: |
04:54:24 | zachcarter | filename = key |
04:54:25 | zachcarter | of cmdLongOption, cmdShortOption: |
04:54:27 | zachcarter | case key |
04:54:28 | zachcarter | of "help", "h": writeHelp() |
04:54:30 | zachcarter | of "version", "v": writeVersion() |
04:54:31 | zachcarter | else: |
04:54:33 | zachcarter | echo "not understood" |
04:54:34 | zachcarter | of cmdEnd: assert(false) # cannot happen |
04:54:36 | zachcarter | if filename == "": |
04:54:37 | zachcarter | # no filename has been given, so we show the help: |
04:54:38 | zachcarter | writeHelp() |
04:54:39 | zachcarter | whoops sorry |
04:54:40 | zachcarter | I meant to past a link to a gist not that haha |
04:54:54 | zachcarter | https://gist.github.com/zacharycarter/5bd1a7b411316bc30bff2749ad7b9535 Nobabs27 |
04:55:12 | Nobabs27 | lol |
04:55:51 | zachcarter | docopt is a lot nicer than that code |
04:56:14 | zachcarter | if you can use docopt I’d highly reccomend it - it allows you to specify the specification for your command line interface via documentation |
04:57:10 | Nobabs27 | yeah looks cool ill give it a try |
04:57:53 | Nobabs27 | except now I need to get nimble to work xD |
04:58:46 | Nobabs27 | ok nice that was simple (yaourt -S --noconfirm nimble) |
04:59:33 | zachcarter | :) |
05:02:17 | Nobabs27 | difference between parseopt2 vs docopt ? |
05:03:01 | zachcarter | parseopt2 is a core nim library |
05:03:15 | zachcarter | docopt is a library someone wrote that is similar to a popular python library docopt |
05:03:25 | zachcarter | parseopt2 isn’t even a library it’s a module |
05:03:34 | zachcarter | https://nim-lang.org/docs/parseopt2.html |
05:03:50 | zachcarter | docopt is much more feature rich |
05:11:31 | * | bjz_ joined #nim |
05:13:54 | * | bjz quit (Ping timeout: 268 seconds) |
05:24:33 | * | r4vi_ joined #nim |
05:27:55 | * | stisa1 joined #nim |
05:28:56 | Nobabs27 | maybe the simplest thing would be to just handle the exception? |
05:29:36 | zachcarter | you could do that |
05:30:05 | * | krux02 quit (Quit: Leaving) |
05:30:29 | * | bbl_ joined #nim |
05:30:55 | * | libman quit (Quit: Connection closed for inactivity) |
05:33:29 | * | stisa quit (Ping timeout: 252 seconds) |
05:33:29 | * | r4vi quit (Ping timeout: 252 seconds) |
05:33:30 | * | bbl quit (Ping timeout: 252 seconds) |
05:34:00 | * | r4vi_ is now known as r4vi |
05:37:56 | Nobabs27 | how bad of an idea is it to assume the reason for an IndexError? |
05:37:59 | Nobabs27 | ie: |
05:38:05 | Nobabs27 | except IndexError: echo "args pls" |
05:40:25 | * | bjz joined #nim |
05:40:44 | * | bjz_ quit (Ping timeout: 240 seconds) |
05:42:16 | zachcarter | I mean it depends on the intended user and purpose of your program |
05:42:52 | zachcarter | if it’s a simple program meant to be used by someone familiar with how the program functions, then it’s probably fine |
05:55:42 | * | rauce quit (Ping timeout: 240 seconds) |
06:02:28 | Nobabs27 | ok |
06:04:58 | * | brson quit (Ping timeout: 240 seconds) |
06:08:55 | * | Nobabs27 quit (Quit: Leaving) |
06:13:15 | * | rauce joined #nim |
06:34:24 | * | PMunch quit (Quit: leaving) |
06:36:56 | * | nsf joined #nim |
06:43:26 | * | chemist69 quit (Ping timeout: 255 seconds) |
06:45:52 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
06:46:11 | * | chemist69 joined #nim |
06:47:33 | * | def-pri-pub quit (Quit: leaving) |
07:00:42 | zachcarter | my file browser is showing all sorts of system and hidden files but eff it |
07:00:46 | zachcarter | user beware |
07:14:18 | * | eizua joined #nim |
08:22:34 | * | bjz joined #nim |
08:26:43 | * | yglukhov joined #nim |
08:31:14 | * | yglukhov quit (Ping timeout: 268 seconds) |
08:57:46 | FromGitter | <Varriount> zachcarter: :3 |
08:57:59 | zachcarter | o/ varriount |
08:58:19 | zachcarter | feeling any better? |
09:02:32 | * | yglukhov joined #nim |
09:18:34 | * | themagician joined #nim |
09:23:32 | * | Arrrr joined #nim |
09:29:12 | * | Vladar joined #nim |
09:38:27 | * | stisa1 is now known as stisa |
09:41:24 | * | chemist69 quit (Ping timeout: 240 seconds) |
09:41:26 | * | rokups joined #nim |
09:42:18 | * | chemist69 joined #nim |
10:11:23 | * | ftsf joined #nim |
10:14:26 | * | Matthias247 joined #nim |
10:24:02 | * | dom96 quit (Changing host) |
10:24:02 | * | dom96 joined #nim |
10:33:03 | * | zachcarter quit (Quit: zachcarter) |
10:50:19 | * | bjz_ joined #nim |
10:52:39 | * | bjz quit (Ping timeout: 260 seconds) |
11:33:07 | rokups | is there any way to dump PNode/PSym/PType in a compiler? something like dumpTree in macros module |
11:38:31 | dom96 | debug |
11:41:03 | dom96 | It would be great if these were changed to reflect the macros module |
11:41:28 | * | yglukhov quit (Remote host closed the connection) |
11:43:05 | * | bjz joined #nim |
11:43:24 | * | bjz_ quit (Ping timeout: 240 seconds) |
11:47:40 | * | Trustable joined #nim |
11:48:49 | * | yglukhov joined #nim |
11:53:04 | * | yglukhov quit (Ping timeout: 240 seconds) |
11:54:45 | Araq | rokups read this please: https://nim-lang.org/docs/intern.html#debugging-the-compiler |
12:02:20 | * | yglukhov joined #nim |
12:03:32 | * | dddddd joined #nim |
12:10:09 | * | djellemah quit (Ping timeout: 268 seconds) |
12:13:43 | * | Pisuke joined #nim |
12:15:29 | * | MyMind quit (Ping timeout: 240 seconds) |
12:25:43 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
12:35:17 | * | yglukhov quit (Remote host closed the connection) |
12:44:29 | * | abeaumont joined #nim |
12:53:05 | * | djellemah joined #nim |
13:12:15 | * | krux02 joined #nim |
13:22:21 | * | shashlick quit (Ping timeout: 260 seconds) |
13:22:44 | * | shashlick joined #nim |
13:44:57 | * | zachcarter joined #nim |
13:48:40 | zachcarter | o/ morning |
13:59:36 | niv | hello |
13:59:40 | dom96 | hi |
13:59:54 | niv | quick question: https://gist.github.com/niv/7a93426f89ed7e50159c5e7bf2bea388 create as wiki page [y/n]? |
14:00:27 | * | yglukhov joined #nim |
14:01:22 | dom96 | y |
14:04:14 | demi- | goddamn, i go to make a simple windowing system using termbox and now i'm contemplating writing a layout system so that it can be resized properly |
14:04:49 | niv | https://github.com/nim-lang/Nim/wiki/Run-nim-source-files-like-scripts-(with-tcc-and-binfmt_misc) |
14:05:01 | niv | *throws it over the wall and runs away* |
14:10:08 | federico3 | niv: I guess you want to avoid the limitations of nimscript? |
14:11:44 | * | djellemah quit (Ping timeout: 240 seconds) |
14:11:47 | niv | it was honestly just an experiment because i got fed up by long compilation times, so i looked into tcc, and that's the result |
14:12:36 | niv | binfmt_misc is pretty cool though |
14:15:28 | * | dddddd quit (Remote host closed the connection) |
14:18:40 | zachcarter | what’s the best thing to map cstrings to in nim? |
14:19:48 | federico3 | niv: a nims script could write out a temporary .nim file using https://github.com/FedericoCeratto/nim-morelogging/blob/master/tests/testutils.nim#L73 and then compile and run it. A solution looking for a problem. :) |
14:19:51 | zachcarter | I’m looking at example C code like - https://github.com/vurtun/nuklear/blob/master/demo/overview.c#L473 |
14:20:50 | zachcarter | If I just use strings in Nim I’m not sure how to do things like - https://github.com/vurtun/nuklear/blob/master/demo/overview.c#L483 |
14:21:19 | zachcarter | I’ve been using sequences of chars but I’m not sure if that’s right either, doubtful |
14:22:50 | * | eizua quit (Remote host closed the connection) |
14:25:05 | * | djellemah joined #nim |
14:25:10 | dom96 | map them to strings |
14:25:33 | zachcarter | alright so when I do that |
14:25:36 | dom96 | What are you unsure of? |
14:25:43 | dom96 | `&text_len[0]`? |
14:26:02 | zachcarter | I get that that’s a pointer to an index in the string right |
14:26:14 | dom96 | well, that seems to be an array of ints actually |
14:26:21 | dom96 | but &text[0] is a pointer to the first char |
14:26:25 | dom96 | In Nim: addr text[0] |
14:26:33 | zachcarter | right okay |
14:26:42 | dom96 | (and 'text' can be either a cstring or a string in this case) |
14:27:17 | zachcarter | okay, I guess what’s confusing me is when I examine the value of a string like text at runtime when I think its value should be set to something, it’s echoing as an empty string |
14:27:24 | zachcarter | i’m probalby not doing something right with nuklear |
14:28:04 | zachcarter | I’ll play around with the api he offers more, thank you dom96 |
14:28:18 | dom96 | try using repr |
14:28:34 | zachcarter | yeah I was |
14:29:46 | zachcarter | oh weird if I echo the length of the string first |
14:29:52 | zachcarter | I actually get the string back |
14:30:49 | zachcarter | nevermind, I must have been doing something wrong it’s working as expected now thanks again dom96 |
14:30:55 | dom96 | np |
14:36:25 | demi- | is there any way to do inverse ranges? like i can iterate from 0->5 using `0..5` but can i go in the opposite direction? |
14:39:12 | * | Matthias247 quit (Read error: Connection reset by peer) |
14:39:26 | dom96 | demi-: countdown() |
14:39:28 | * | PMunch joined #nim |
14:41:22 | zachcarter | this is curious... |
14:42:14 | zachcarter | https://gist.github.com/zacharycarter/984311590ca397fa39bc63f2a2fd51cd |
14:42:53 | zachcarter | I wonder why it echos t and then the correct value test |
14:43:37 | demi- | thank you dom96 |
14:43:55 | zachcarter | I updated the gist with what happens when I use repr as well |
14:45:24 | * | abeaumont quit (Ping timeout: 240 seconds) |
14:45:33 | * | Jesin quit (Ping timeout: 268 seconds) |
14:49:37 | * | Jesin joined #nim |
14:59:27 | PMunch | Hmm, I'm wondering. LibUI should really be ported to Nim shouldn't it? |
14:59:42 | PMunch | If the goal is to use it as Nims default graphical framework that is |
15:01:24 | zachcarter | I think that’s what nimx is an attempt at |
15:01:28 | zachcarter | I mean not a port of libui |
15:01:34 | zachcarter | but to be a pure nim gui framework |
15:01:49 | PMunch | Oh yeah, but it does it's own thing |
15:02:09 | PMunch | LibUI is basically just a thin wrapper around Gtk, win32, and cocoa |
15:02:19 | zachcarter | hrm |
15:02:23 | zachcarter | do you really want to write that :/ |
15:02:23 | PMunch | So when you ask for a Checkbox it basically just does the right call |
15:02:38 | PMunch | Haha, not really :P |
15:02:45 | zachcarter | I personally cannot stand writing native windowing / gui code |
15:03:01 | dom96 | Might be fun if you keep it simple :) |
15:03:12 | dom96 | But maybe I'm the only one that finds these kinds of things fun |
15:03:16 | zachcarter | until you start having to write objective-c |
15:03:18 | PMunch | Well, since we have binding for at least gtk and win32 it should be a pretty simple (albeit a bit boring) conversion job |
15:03:48 | zachcarter | look at this hell |
15:04:06 | zachcarter | https://github.com/yglukhov/nimx/blob/master/nimx/private/windows/appkit_window.nim |
15:04:57 | PMunch | https://github.com/andlabs/libui/blob/master/unix/combobox.c |
15:04:59 | zachcarter | I guess if you’re familiar with obj-c and cocoa it won’t be so bad |
15:05:09 | PMunch | That's the thing though |
15:05:22 | PMunch | With the existing bindings it should be fairly trivial to convert |
15:05:33 | PMunch | As you can see libui is pretty basic |
15:05:36 | zachcarter | yeah |
15:06:40 | zachcarter | dom96: can you think of a reason off the top of your head my strings would be echoing the correct value when echod individually but when concatened, or reprd that’s not the case |
15:07:00 | zachcarter | when reprd they repr like the address to an empty string |
15:08:33 | demi- | zachcarter: you do realize that AppKit and NSWindow have been around for like 30 years? |
15:08:55 | demi- | and have changed platforms a couple of times |
15:09:45 | zachcarter | I wasn’t demi- |
15:10:09 | demi- | it is an extremely complicated UI platform |
15:11:19 | zachcarter | from my limited experience with it I’d agree |
15:13:08 | krux02 | time makes things more complicated |
15:13:32 | krux02 | especially when people don't know whot to focus on, then they start to develop unnecessary full |
15:15:48 | krux02 | zachcarter: about the strings, when you concatenate them, you concatenate the content literally, including 0-bytes |
15:16:03 | zachcarter | ah so I need to trim first? |
15:16:10 | dom96 | yeah, the \0 bytes are most likely to be problematic |
15:16:15 | krux02 | that shouldn't destroy a string, but let's the printed version look a bit different than expected |
15:16:28 | zachcarter | ahh this makes sense okay thank you |
15:16:31 | krux02 | trim removes whitespace |
15:16:32 | dom96 | If the C function gives you the length it wrote to the string then you can write: str.setLen(len) |
15:16:49 | dom96 | to "trim" it :) |
15:16:56 | zachcarter | haha okay cool thanks |
15:18:35 | zachcarter | worked perfectly thank you guys so much |
15:20:39 | * | yglukhov quit (Remote host closed the connection) |
15:21:04 | * | rauss joined #nim |
15:22:55 | * | yglukhov joined #nim |
15:42:46 | * | PMunch quit (Quit: leaving) |
15:46:23 | * | LeNsTR|away is now known as lenstr |
15:46:51 | zachcarter | hrm it doesn’t seem like there’s a way to write comments to a config file using - https://nim-lang.org/docs/parsecfg.html#next,CfgParser |
15:47:00 | zachcarter | unless I’m missing something |
15:47:19 | zachcarter | does that mean I’ll have to open the file once to write comments then open it again to make the https://nim-lang.org/docs/parsecfg.html#writeConfig,Config,string call? |
15:48:56 | zachcarter | I guess I can do dict.setSectionKey("","#","test") |
15:49:03 | zachcarter | not ideal but it works |
15:50:17 | demi- | one thing that bugs me about the parsecfg module is that there is no iterator for sections names |
15:51:05 | demi- | it can do that but only if you sequentially parse the file, but there doesn't seem to be one for accessing the section names outside of that context. |
15:51:30 | zachcarter | hrm |
15:51:44 | zachcarter | that does seem not so great |
15:52:02 | zachcarter | maybe I’d be better served storing config in that yaml project you guys linked me to the other day |
15:56:59 | * | rauss quit (Quit: WeeChat 1.7) |
15:58:45 | dom96 | PRs welcome for improvements to the parse* modules. In fact, this setSectionKey and similar should not be in the parsecfg module but in a 'cfg' module. |
15:59:03 | dom96 | The parseopt module could also use a similar improvement to its interface |
15:59:10 | dom96 | via a 'opt' or 'cmdopt' or whatever module |
16:01:05 | zachcarter | okay question then |
16:01:45 | zachcarter | writeconfig is obviously the method all file IO should go through in terms of writing to the cfg file |
16:02:07 | zachcarter | and the table format it expects is [section, key, value] |
16:02:38 | zachcarter | would the best way to do comments then be when the section is ! or # or ; assume comment? |
16:02:51 | zachcarter | and then add that to the docu explicitly stating that? |
16:03:02 | zachcarter | or allow some other method for specifying comments |
16:03:40 | dom96 | I would probably go with some other method for specifying comments |
16:03:56 | dom96 | But I'm not familiar with the details of how this config writing stuff works in parsecfg |
16:04:19 | zachcarter | the problem is avoid unnecessary I/O |
16:05:07 | zachcarter | there’s really only one method to write config atm and that’s this method - https://github.com/nim-lang/Nim/blob/master/lib/pure/parsecfg.nim#L485 |
16:05:40 | zachcarter | if I were to introduce a proc like writecomment I’d have to re-open the file I believe right? |
16:06:00 | demi- | what is the justification for writing a comment? |
16:06:16 | zachcarter | because config files allow for them? |
16:06:27 | zachcarter | if I’m producing an automated config file I don’t want anyone touching |
16:06:42 | demi- | I think that you should just serialize it as a normal file then |
16:06:43 | zachcarter | I’d like to be able to warn readers of that |
16:07:25 | Arrrr | +1 |
16:08:09 | zachcarter | hmm |
16:08:50 | zachcarter | what exactly do you mean when you say normal file? |
16:09:22 | zachcarter | like a non cfg file? |
16:09:35 | demi- | like, use regular file IO methods to write out the file without using the cfg module |
16:09:42 | zachcarter | ah I see what you’re saying |
16:10:06 | zachcarter | yeah it’s not a huge deal to do so |
16:10:48 | demi- | the point of comments are to be seen by the end-user, not by the system, there wouldn't be a proper way to represent them in code when they get taken in when the cfg gets parsed. |
16:11:28 | zachcarter | yeah I think that’s why the parser just ignores them |
16:11:32 | zachcarter | which is fine |
16:12:02 | zachcarter | I mean if parsecfg is just for parsing cfg files I understand not wanting a bunch of write methods in there, and I get that the one write method that exists is essentially just serializing a table |
16:12:09 | zachcarter | using the I/O operations available in system |
16:12:28 | zachcarter | I was essentially just looking for a convenience method |
16:18:11 | dom96 | I would say that there should be a `$` to get the string representation of the config |
16:18:20 | dom96 | then you can easily add your comments |
16:23:38 | * | brson joined #nim |
16:25:38 | * | yglukhov quit (Remote host closed the connection) |
16:29:40 | demi- | is there a nim-lang package for ubuntu that is part of apt-get? |
16:38:40 | FromGitter | <Jeff-Ciesielski> IIRC, you can just `apt-get install nim` |
16:39:08 | niv | ubuntu has nim, but its "a bit" old (0.12) |
16:39:54 | demi- | yeah my ubuntu apparently doesn't have a package for that |
16:40:18 | federico3 | Xenial has .12, Yakkety .13 and Zesty .16 |
16:40:31 | dom96 | ooh, zesty has .16? wow |
16:40:32 | niv | i guess im on xenial then |
16:40:50 | federico3 | dom96: it's pulling my packages from Debian Sid |
16:41:01 | dom96 | federico3: awesome, does it include Nimble as well? |
16:41:11 | federico3 | yep |
16:41:20 | niv | is there a ppa you can link in without adding unstable to apt? |
16:41:59 | federico3 | niv: you can add unstable and pin it at lower priority or just grab the file from any mirror |
16:42:15 | demi- | i have no idea how to do that |
16:42:16 | niv | i could do that, i guess. |
16:42:24 | federico3 | niv: like the wgets in https://github.com/nim-lang/Nim/wiki/BuildServices |
16:42:29 | niv | grabbing manually divests me of receiving updates though |
16:43:15 | demi- | my alternative here is giving myself a crash course in docker |
16:43:29 | niv | omg, docker. good luck |
16:43:32 | federico3 | urgh |
16:43:52 | niv | docker is great natively, but forget about it on osx or windows |
16:46:08 | federico3 | or in production or on a slightly older system... |
16:46:13 | * | libman joined #nim |
16:46:13 | Calinou | how about providing the Nim tools as AppImage? :) |
16:46:17 | Calinou | is that doable? |
16:46:37 | Calinou | so you can acquire the latest version from binaries, and use it on any distro |
16:46:45 | federico3 | ooh appimage supports firejail, very nice |
16:47:53 | Calinou | yes, it also supports delta updates, GPG2-signing |
16:48:24 | Calinou | AppImage depends only on libfuse, no dependency on init system (Flatpak used to depend on systemd, now it's no the longer the case, but it still requires a runtime) |
16:48:42 | Calinou | they're compressed (gzip by default, if I'm not mistaken), and use SquashFS, so they're fast to open |
16:48:50 | Calinou | lastly, they can have desktop integration (optional) |
16:49:06 | federico3 | for some values of "fast" :) |
16:49:15 | Calinou | and if you want to "install" them system wide, just move and rename the AppImage to /usr/local/bin or somewhere else in your PATH |
16:49:48 | niv | how would you handle a nim distro as an appimage though? you'd need nim and nimble at the very least, and probably others |
16:49:58 | Calinou | niv: several AppImages, I figure |
16:50:12 | federico3 | and make all the libs available to the compiler and other tools |
16:50:14 | Calinou | we can supply a .zip containing appimages of nim, nimble, and an install script |
16:50:29 | Calinou | yes, handling libraries will be harder |
16:50:33 | niv | so nimble would have to open up the nim appimage to get at stdlib, i suppose |
16:50:52 | Calinou | do note that AppImages are read-only |
16:51:04 | niv | im not so sure this is an advantage over just shipping a tarball |
16:51:12 | federico3 | hence it's not going to be that fast |
16:51:12 | niv | but im old and grumpy, so dont listen to me |
16:51:31 | dom96 | What is this new fangled AppImage you speak of? :) |
16:51:44 | Calinou | hi dom96 :) it's this: http://appimage.org/ |
16:51:54 | niv | yeah. get of my grass. also, 0.16.1 please with the nimble bin=@[] fix |
16:52:21 | federico3 | yes please! |
16:52:24 | dom96 | Awesome. But seems more aimed at GUI apps. |
16:52:44 | dom96 | I've got a basic version of choosenim working now. |
16:52:44 | niv | i want to build nimble packages that export binaries but it just doesnt work yet :) |
16:52:55 | dom96 | That should make management of different Nim versions much easier for us all |
16:52:55 | federico3 | snap and flatpak might not have the limitation of 1pkg <-> 1 executable |
16:53:12 | dom96 | I wonder whether I should go as far as downloading the C compiler for Windows users. |
16:53:35 | niv | dom96: maybe bundling a mingw/gcc zip might not be a terrible idea? |
16:53:49 | dom96 | niv: I want a single exe |
16:53:56 | dom96 | That downloads whatever is needed |
16:54:18 | niv | 99% of windows users (at least in my experience) cant be bothered to go grab mingw and some end up grabbing the wrong package and then they dont set up PATH properly and nothing works and they just throw their hands up |
16:54:28 | dom96 | choosenim 0.16.0 # downloads Nim 0.16.0, bootstraps and creates a proxy exe in ~/.nimble/bin/{nim, nimble, nimgrep, nimsuggest} |
16:54:37 | Calinou | dom96: nice, so it's a bit like rustup? |
16:54:45 | dom96 | yeah, it's exactly like rustup :) |
16:54:48 | Calinou | I approve having a toolchain chooser, it can be pretty handy for handling different versions |
16:54:51 | niv | thats a good idea, dom96 |
16:54:59 | * | Sentreen quit (Ping timeout: 255 seconds) |
16:55:16 | niv | on windows, it should be able to grab mingw/tcc transparently for you and make it work |
16:55:18 | dom96 | I want to make Nim installation as easy as copying a single command into your terminal |
16:55:21 | dom96 | On all OS' |
16:55:30 | niv | sounds great |
16:55:31 | dom96 | So I guess it should grab MINGW for the user too D: |
16:55:55 | dom96 | Windows will be a PITA, I can already sense it. |
16:55:58 | niv | yeah. a bundled gcc 5.x will do well and isnt too big. it doesnt need to be system-wide |
16:56:07 | Calinou | why not GCC 6.x? mingw-w64 has that |
16:56:11 | Calinou | (also has 64-bit GCC, I believe) |
16:56:11 | niv | or that. |
16:56:28 | Calinou | mingw-w64 uses SourceForge for its downloads, so we may need to mirror them somewhere else |
16:56:33 | niv | or tcc, although its a pain with linking from what i heard, at least on windows |
16:56:36 | Calinou | other than that, the toolchains are quite up-to-date |
16:56:46 | dom96 | The nim site already hosts mingw |
16:57:01 | niv | could choosenim not bundle a dedicated zip without going through the mingw installer? |
16:57:04 | dom96 | I'll just need to repackage it into a .tar.gz :) |
16:57:28 | Calinou | talking about https://sourceforge.net/projects/mingw-w64/ by the way |
16:57:29 | niv | a quick option for people to get started. if they want to customise they can always install mingw/vcc/whatever themselves |
16:57:35 | euantor | @dom96 since you're here, any chance you can edit this topic to fix the link? It's missing the HTTP: https://forum.nim-lang.org/t/2819 |
16:58:15 | dom96 | euantor: sure, done |
16:58:25 | euantor | Nice one, thanks |
16:59:20 | dom96 | Yeah, I might even not bother checking if the user has their own MINGW (for now at least) |
16:59:25 | dom96 | It will just lead to problems |
16:59:41 | stisa | niv: about tcc, is it the one in the git repo of nim, in the `tinyc` folder? |
17:00:00 | federico3 | dom96: have you looked into flatpak? |
17:00:08 | niv | dom96: nim could default to a config.nim that points to a package-local gcc install by default, and the user can then go and edit it to point elsewhere if they wanted to |
17:00:50 | dom96 | federico3: nope, what is it? |
17:00:58 | niv | stisa: sorry, i dont know. i just tried it out on linux to compile nim apps because clang was about twice as slow. i googled if i could ship a more streamlined package for the project im working on (embed tcc) but looks like tcc cant link some libs |
17:01:04 | federico3 | dom96: http://flatpak.org/ |
17:01:17 | federico3 | a superset of what appImage does |
17:01:18 | Calinou | Flatpak tries to solve a problem similar to AppImage, but it has a different approach |
17:01:29 | Calinou | it requires a runtime, doesn't run on very old distros though |
17:02:06 | dom96 | oh dear, I hope we won't end up with two different incompatible appimage-like solutions |
17:08:21 | * | Sentreen joined #nim |
17:09:35 | * | onionhammer quit (Quit: WeeChat 1.0.1) |
17:15:47 | * | onionhammer joined #nim |
17:17:11 | euantor | And there's also Canonical's snap format |
17:17:37 | euantor | https://xkcd.com/927/ - relevant XKCD |
17:20:55 | federico3 | I'll point out that CircleCI stores and serves build artifacts over HTTPS |
17:21:41 | FromGitter | <zetashift> Getting a 'Hint: [Link] ⏎ Error: unhandled exception: Access is denied. ⏎ [OSError]' when trying to run first block of code of https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-with-sdl2/ |
17:22:08 | FromGitter | <zetashift> any ideas how i can fix this? windows 10 64bit |
17:24:36 | FromGitter | <zetashift> ah seems I'm having this error even on a simple hello world |
17:39:26 | Calinou | dom96: we already have incompatible solutions :( |
17:39:31 | Calinou | it was bound to happen |
17:42:04 | * | brson quit (Ping timeout: 240 seconds) |
17:52:06 | * | yglukhov joined #nim |
18:02:24 | * | yglukhov quit (Remote host closed the connection) |
18:03:20 | krux02 | zetashift: can you greate a pastbin/ix.io/gist with the code you have? |
18:06:28 | * | rauss joined #nim |
18:09:44 | FromGitter | <zetashift> I fixed it, reinstalled nim with seemed to work |
18:10:27 | * | Matthias247 joined #nim |
18:13:53 | * | yglukhov joined #nim |
18:18:55 | * | yglukhov quit (Ping timeout: 268 seconds) |
18:32:27 | zachcarter | so I have a C callback I’m getting nill access errors inside and I ran lldb and saw that I crashing during some GC calls, and of course I forgot to call setupForeignThreadGc() inside the callback |
18:32:33 | zachcarter | but even with that call I’m still getting nill errors |
18:33:28 | zachcarter | https://gist.github.com/zacharycarter/362411d0570226739053578b5008e76f |
18:33:45 | zachcarter | is there something else I’m forgetting to do |
18:43:38 | Araq | zachcarter: sounds like you misuse the C callback to "share" two different GC heaps or rather have cross-threads refs etc |
18:43:59 | zachcarter | hrm okay |
18:44:16 | zachcarter | thank you Araq I’ll investigate further |
18:52:26 | * | chemist69 quit (Ping timeout: 255 seconds) |
18:57:04 | * | chemist69 joined #nim |
19:01:31 | * | dddddd joined #nim |
19:01:40 | * | djellemah_ joined #nim |
19:02:11 | * | rokups quit (Quit: Connection closed for inactivity) |
19:05:10 | subsetpark | Huh. Who can think of why my version of the Nim compiler doesn't implement Deque.len? |
19:07:39 | * | yglukhov joined #nim |
19:07:56 | subsetpark | Oh never mind! Sometimes I forget I need to import modules everywhere I call procs on their objects, even if I don't refer to the types or initializers |
19:19:35 | zachcarter | hrm I have no idea how to avoid this misuse of the C callback Araq - I am accessing memory outside of the callback but I’m not sure how to control which GC heap it was allocated on or how to avoid cross thread refs here |
19:20:02 | zachcarter | I’ll try to create a much simpler example and see if I get the same kind of behavior |
19:20:58 | Araq | why does the C library impose some threading scheme onto your code? that's bad design |
19:22:19 | zachcarter | it’s a good question |
19:22:27 | * | smt_ joined #nim |
19:22:28 | * | smt quit (Ping timeout: 240 seconds) |
19:22:28 | zachcarter | I’m going to see if it’s actually glfw causing the problem |
19:24:32 | * | synshroud quit (Quit: ZNC 1.6.4 - http://znc.in) |
19:25:36 | * | smt_ is now known as smt |
19:28:54 | zachcarter | yeah it’s definitely a problem with nuklear |
19:35:18 | * | synshroud joined #nim |
19:36:46 | zachcarter | or bgfx |
19:42:28 | * | rauss quit (Quit: WeeChat 1.7) |
19:51:08 | * | bjz joined #nim |
19:54:45 | * | raiz joined #nim |
19:56:19 | * | Nobabs27 joined #nim |
19:57:36 | * | Salewski joined #nim |
19:58:27 | Salewski | const MININT16 = -32768'i16 # generated by gobject introspection |
19:58:31 | Salewski | h5.nim(557, 19) Error: number 32768'i16 out of valid range |
19:59:00 | Salewski | Is that an issue that should be reported? |
20:05:48 | Salewski | Of course no problem for me, I may drop that const or replace by G_MININT16* = 0x8000'i16 an done by c2nim |
20:06:08 | Araq | it's not a bug. the minus is not part of the number literal |
20:06:31 | Araq | it's - (32768'i16) and that is indeed an invalid int16 |
20:06:41 | Salewski | I know, but people may type it in in that way. |
20:07:10 | Araq | people can be expected to learn the programming language they use |
20:07:38 | Araq | it's not a Nim specific issue anyway |
20:07:52 | Araq | plenty of other languages work this way too. |
20:08:05 | Salewski | OK. |
20:08:39 | Araq | btw G_MININT16 shouldn't be part of your wrapper IMO |
20:09:09 | Salewski | Yes I agree. |
20:09:09 | Araq | that's an artifact of old C missing a limits.h file |
20:10:32 | Salewski | I really only asked because other people may wonder if they try to define their own min int32 or min int64. |
20:10:56 | Araq | low(int16) |
20:11:01 | dom96 | who was it that managed to embed a DLL into a Nim app and then load it before the app started? |
20:11:20 | Salewski | Bye. |
20:11:26 | Araq | bye |
20:11:34 | * | Salewski left #nim (#nim) |
20:16:04 | * | def-pri-pub joined #nim |
20:28:21 | * | yglukhov quit (Remote host closed the connection) |
20:32:37 | * | yglukhov joined #nim |
20:35:05 | * | byte512 quit (Remote host closed the connection) |
20:47:52 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
20:56:11 | * | djellemah quit (Ping timeout: 255 seconds) |
21:13:03 | * | bjz joined #nim |
21:25:52 | FromGitter | <Varriount> zachcarter: Any solution to your threading problem? |
21:27:03 | * | Arrrr quit (Quit: Leaving.) |
21:32:50 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:55:40 | * | Kingsquee joined #nim |
22:02:28 | * | ofelas quit (Remote host closed the connection) |
22:02:47 | * | ofelas joined #nim |
22:02:50 | * | Vladar quit (Quit: Leaving) |
22:08:28 | * | kunev quit (Ping timeout: 240 seconds) |
22:10:09 | * | kunev joined #nim |
22:15:44 | * | def-pri-pub quit (Ping timeout: 260 seconds) |
22:21:27 | * | yglukhov quit (Remote host closed the connection) |
22:22:09 | * | PMunch joined #nim |
22:24:50 | * | yglukhov joined #nim |
22:27:52 | * | Trustable quit (Remote host closed the connection) |
22:29:17 | * | yglukhov quit (Ping timeout: 260 seconds) |
22:29:20 | * | def-pri-pub joined #nim |
22:37:32 | * | nsf quit (Quit: WeeChat 1.7) |
22:46:38 | * | abeaumont joined #nim |
22:47:50 | PMunch | Can I get a reference to an object in Nim? |
22:48:13 | PMunch | Say I have an object, and I want to create ie. a structure that points to those objects |
22:48:37 | zachcarter | Hey Varriount: I did figure it out thank you for asking. I was copying a string to a member of an object and that string was getting GC’d that was my issue |
22:48:51 | zachcarter | PMunch - addr(object) |
22:49:04 | zachcarter | unless I’m not understanding what you’re asking |
22:49:44 | PMunch | Isn't addr just an untraced pointer |
22:50:58 | * | ofelas quit (Remote host closed the connection) |
22:51:15 | * | ofelas joined #nim |
22:51:41 | zachcarter | ah okay I missed the object part sorry |
22:52:17 | zachcarter | let foo: ref Bar = new(Bar) |
22:52:45 | zachcarter | type |
22:52:56 | zachcarter | FooRef* = ref Foo |
22:53:27 | zachcarter | let foobar = FooRef(bar: “foo”) |
22:54:18 | zachcarter | or you can just declare the entire object as a ref object |
22:54:22 | zachcarter | type |
22:54:30 | zachcarter | Foo* = ref object |
22:54:40 | zachcarter | bar*: int |
22:55:29 | zachcarter | that’s the only way I know of to declare reference types in nim |
22:56:51 | zachcarter | maybe you’re asking about this - https://forum.nim-lang.org/t/322 |
23:01:24 | * | chemist69 quit (Ping timeout: 240 seconds) |
23:04:38 | * | ftsf_ joined #nim |
23:05:17 | * | themagician quit () |
23:09:27 | PMunch | Ah right |
23:09:30 | PMunch | That makes sense.. |
23:15:28 | * | ofelas quit (Remote host closed the connection) |
23:15:52 | * | ofelas joined #nim |
23:25:58 | * | ofelas quit (Remote host closed the connection) |
23:26:21 | * | ofelas joined #nim |
23:28:36 | * | chemist69 joined #nim |
23:38:24 | Araq | PMunch: thank you for your ui PR :-) |
23:38:33 | PMunch | No problem :) |
23:38:36 | Araq | haven't yet had a chance to review it |
23:38:43 | PMunch | It's a pretty trivial one |
23:39:02 | PMunch | Doesn't fix the build issues unfortunately |
23:39:32 | PMunch | Mostly minor changes for consistency |
23:40:16 | PMunch | Unfortunately I find that libui is a bit too limited |
23:40:27 | PMunch | It doesn't even have a scrolling container :S |
23:40:46 | PMunch | And no way to for example get a selection from an entry, or set the cursor position, etc. |
23:40:54 | PMunch | https://github.com/PMunch/ui/blob/master/examples/genuiusg.nim |
23:41:00 | PMunch | But I created that ^ |
23:41:16 | PMunch | Currently writing the equivalent for wxWidgets |
23:44:17 | Araq | what's the point of the % ? |
23:44:30 | PMunch | It's twofold |
23:45:12 | PMunch | "identifier%Widget" creates a "var identifier = Widget()" statement, and just "%identifier" adds a widget stored in a variable |
23:45:36 | PMunch | For example on line 23 you can see the RadioButton widget is assigned to the result variable |
23:45:53 | PMunch | At line 57 the box variable is created and assigned to VerticalBox |
23:46:29 | PMunch | And on line 83 the RadioButtons that was returned from the proc is added to the widget tree |
23:47:24 | PMunch | Lines 69-71 assigns a couple more variables that was previously declared to be referred to in the update proc |
23:48:03 | PMunch | And on line 94 you can see the box variable being used to add the entire hierarchy to the window |
23:49:33 | * | arnetheduck quit (Ping timeout: 260 seconds) |
23:51:28 | * | ofelas quit (Remote host closed the connection) |
23:51:50 | * | ofelas joined #nim |