00:04:14 | * | krux02 quit (Quit: Leaving) |
00:33:13 | FromDiscord | <ShalokShalom> In reply to @ratapenado "Hello, I was wondering": Godot |
00:33:30 | FromDiscord | <ShalokShalom> https://medium.com/swlh/what-makes-godot-engine-great-for-advance-gui-applications-b1cfb941df3b |
00:33:44 | FromDiscord | <Rika> Well he said web interface specifically |
00:33:49 | FromDiscord | <Rika> So I don’t think that applies |
00:33:52 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=1Xhl |
00:34:09 | FromDiscord | <Rika> In reply to @sOkam! "What does this type": The error is further within the template |
00:34:18 | FromDiscord | <Rika> So that’s just a hint really |
00:34:26 | FromDiscord | <ShalokShalom> I assume it's meant to have both web presence and desktop app with one code base |
00:34:41 | FromDiscord | <Elegantbeef> did you miss the 'web interface' |
00:34:52 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=1Xhn |
00:35:33 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "did you miss the": No, I just assumed the intent |
00:35:48 | FromDiscord | <ShalokShalom> And it's 2.35am here 😅 |
00:37:28 | FromDiscord | <sOkam!> I guess it was that `logg` is a template, and I'm defining it wrong in some way I don't understand. Will make it proc for now 🤷♂️ |
00:46:53 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=209u |
00:47:07 | FromDiscord | <sOkam!> (edit) |
00:47:30 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=209u" => "https://play.nim-lang.org/#ix=28AU" |
00:51:25 | arkanoid | how can I reference current table being filled within a sugar.collect loop |
00:52:37 | * | disso_peach quit (Remote host closed the connection) |
00:52:55 | * | disso_peach joined #nim |
00:55:33 | FromDiscord | <Elegantbeef> Dont think you can |
01:01:10 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=2pWI |
01:01:31 | FromDiscord | <Elegantbeef> That's correct, that will not error |
01:02:11 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=2pWK |
01:03:18 | FromDiscord | <sOkam!> why is it segfaulting then? what am i missing? |
01:03:33 | FromDiscord | <Elegantbeef> Are you certain that's where the segfault is? |
01:03:44 | FromDiscord | <sOkam!> i mean, that's where the console says it is |
01:03:57 | FromDiscord | <Elegantbeef> Well without a min reproduction i cannot say much |
01:04:19 | FromDiscord | <sOkam!> i know. i just don't know how to get a minimal reproduction version |
01:04:25 | FromDiscord | <sOkam!> else I would have posted it |
01:04:28 | arkanoid | Lol, nim check process has 12GB heap |
01:04:49 | FromDiscord | <Elegantbeef> What's the actual code you're running into the issue with? |
01:04:57 | FromDiscord | <Elegantbeef> Lol nimcheck might've bit the dust |
01:06:15 | FromDiscord | <sOkam!> In reply to @Elegantbeef "What's the actual code": nimgl/examples/topengl.nim↵but its broken away into separate pieces and objects, the code itself worked before. I'm just doing something wrong with the object declaration/initialization/etc |
01:08:01 | arkanoid | I'm in a loop where nim check fills ram, kernel kills it, work for 5 minutes, repeat |
01:08:05 | FromDiscord | <sOkam!> I added an echo to several lines afterwards, and it seems like that specific line is not the issue |
01:08:18 | FromDiscord | <Elegantbeef> What's the entire procedure? |
01:10:10 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=2vkw |
01:10:26 | FromDiscord | <Elegantbeef> `vert` isnt intialised |
01:12:43 | arkanoid | Now I have to reboot the whole machine due to nim check, damn |
01:13:11 | FromDiscord | <sOkam!> yeah, I guess I will need a newRenderer() proc after all. Thought I could get away without it, but seems more troublesome for complex types |
01:15:37 | FromDiscord | <CircArgs> sent a code paste, see https://play.nim-lang.org/#ix=2x7F |
01:16:27 | FromDiscord | <Elegantbeef> Cause you do `.uint64` which means the integer has to be valid |
01:16:34 | FromDiscord | <Elegantbeef> you should do `18446744073709551602u64` |
01:18:27 | FromDiscord | <CircArgs> @ElegantBeef Thanks it worked! Would you mind clarifying "has to be valid" what is invalid about it with or without the cast? |
01:19:19 | FromDiscord | <Elegantbeef> `18446744073709551602` is parsed as a `int` |
01:19:19 | FromDiscord | <Elegantbeef> That's outside of the range of `int` as such it errors |
01:20:05 | FromDiscord | <Elegantbeef> the `u64` obviously says "this is a uint64 literal so parse it as such" |
01:21:02 | FromDiscord | <CircArgs> I see that does make sense. thanks for clarifying |
01:30:34 | * | arkurious quit (Ping timeout: 246 seconds) |
01:30:54 | arkanoid | I've found which line sends nim check in a crazy loop that fills computer ram when decommented |
01:41:52 | arkanoid | is it possible to fill an array with collect? |
01:42:18 | arkanoid | kind of collect(array[5,int]): ... |
01:49:15 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=2DAO |
01:49:25 | FromDiscord | <morgan> (edit) |
01:50:38 | FromDiscord | <Elegantbeef> Do you have a bitfield? |
01:53:08 | FromDiscord | <morgan> it looks like it can take `SomeInteger`, it's an `int` and uses an int to choose which bit is being set https://media.discordapp.net/attachments/371759389889003532/1032109111053144075/unknown.png |
01:53:48 | FromDiscord | <Elegantbeef> What is the type of `myObj2Int`? |
01:54:08 | FromDiscord | <morgan> `int` |
01:55:42 | FromDiscord | <Elegantbeef> And what's the typedefinition for the type with that field? |
01:55:46 | FromDiscord | <morgan> MyObj2 also contains a string and an array of `int`s that i've successfully used bitops stuff with for a bit now |
01:56:43 | FromDiscord | <Elegantbeef> Cannot say much without any code |
01:59:31 | FromDiscord | <morgan> i'll just replace it with oring with a shifted 1 |
01:59:59 | FromDiscord | <morgan> that's probably what it does anyways and its not that performance critical |
02:33:37 | FromDiscord | <Patitotective> i was making a pr to nim-lang/packages and to test my changes i had to fetch thousands of repositories, that with slow internet takes too much time (more than 10 mins) so i was wondering if introducing a `-d:dontFetchRepos` flag to test everything but the repos was something that could be considered to include in `package_scanner.nim` 🤔 |
02:33:55 | FromDiscord | <Elegantbeef> Prs welcome |
02:34:27 | FromDiscord | <Patitotective> In reply to @Elegantbeef "*Prs welcome*": already making it ;] |
03:11:29 | * | derpydoo quit (Quit: derpydoo) |
03:48:18 | * | NimBot joined #nim |
03:48:21 | * | Onionhammer joined #nim |
03:48:41 | * | def-- is now known as def- |
03:49:52 | * | m5zs7k joined #nim |
03:49:59 | * | jkl joined #nim |
03:59:40 | * | kenran joined #nim |
04:19:00 | * | vicecea joined #nim |
04:27:29 | * | hochata quit (Remote host closed the connection) |
04:31:24 | * | kenran quit (Remote host closed the connection) |
05:55:28 | * | kenran joined #nim |
06:18:20 | * | PMunch joined #nim |
06:57:37 | * | kenran` joined #nim |
06:59:48 | * | kenran quit (Ping timeout: 264 seconds) |
07:12:26 | FromDiscord | <vindaar> arkanoid\: you can either make a PR to add something in `si_units.nim` or you can define your completely own system like so\: https://github.com/SciNim/Unchained/blob/master/examples/custom_unit_system.nim |
07:15:04 | FromDiscord | <Phil> I wonder if you can get a db's name out of a DbConn type. For sqlite it seems already difficult because the core object just appears out of nowhere in the source code |
07:17:01 | FromDiscord | <Phil> That being the Sqlite3 struct and apparently I'm incapable of reading the docs of the c lib because I can't see anything about the structs fields in there |
07:22:55 | * | Jjp137 quit (Read error: Connection reset by peer) |
07:27:13 | FromDiscord | <Phil> Für postgres it seems surprisingly easy, they have a straightforward host field...↵↵Question: does this mean that sqlite types don't have fields?↵`Sqlite3 {.pure, final.} = object` |
07:30:57 | * | Jjp137 joined #nim |
07:32:03 | FromDiscord | <Bung> means cant inherit from it |
07:33:06 | FromDiscord | <Phil> After that line starts a new type definition so no fields defined in that file, just wondering if there might be some c magic going on that grants this type the fields of the c struct |
07:34:52 | FromDiscord | <Phil> I'm pretty sure that at the very least the sqlite struct represents a file handle so shouldn't it somewhere contain the path to the file it's a handle to? |
07:46:40 | FromDiscord | <Elegantbeef> Yes it has no fields |
07:46:53 | FromDiscord | <Elegantbeef> It has no type information and no fields, it's a opaque type |
07:47:21 | FromDiscord | <Elegantbeef> It's likely that the C library has a pointer type which nim uses `ptr T` for |
08:04:57 | * | rockcavera quit (Remote host closed the connection) |
08:11:02 | FromDiscord | <Phil> So I still have a chance of there being a filepath stored somewhere... I just need to figure out how to access the fields on the C struct? |
08:21:09 | FromDiscord | <demotomohiro> C libraries often hide fields of struct so that user cannot access them directly and provide functions to access data stored in the struct. |
08:21:42 | FromDiscord | <Elegantbeef> Yea i'd see if there was a function to access it |
08:22:00 | FromDiscord | <Elegantbeef> If not, then i guess you get to play pointer arithmetic |
08:24:09 | FromDiscord | <demotomohiro> Once you open the file and got a file handle to it, you can read and write to the file without file path.↵It might discard a file path after opening the file. |
08:26:53 | FromDiscord | <Phil> Dangit |
08:59:43 | arkanoid | vindaar, I went to the custom route (actually copypaste of original and edit) |
09:00:26 | arkanoid | vindaar, I've successfully converted all my code to unchained! it works nice, except that nim check now occasionally goes nuts, fills my ram, and I have to hard reboot the machine |
09:00:53 | arkanoid | not quite unchained problem ^^" but yet it's stopping my party |
09:01:26 | FromDiscord | <vindaar> yeah, nimsuggest (or do you run nim check manually?) doesn't like crazy macro code \:(↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
09:05:43 | arkanoid | vindaar, I'm using vscode, which has "check code by using nim check on save" |
09:06:46 | arkanoid | there's also "enable nimsuggests" checkbox, which says it provides suggestions, hover suggestions, etc |
09:16:01 | arkanoid | I'm failing in producing a quite easy template. I just want to repace infix func name and operator https://play.nim-lang.org/#ix=4dyr |
09:25:07 | FromDiscord | <Bung> shouldn't this be legal ? https://github.com/nim-lang/Nim/blob/devel/tests/types/tillegaltyperecursion.nim |
09:27:03 | FromDiscord | <impbox [ftsf]> anyone know of a workaround to get offsetOf to work with array members? |
09:27:15 | FromDiscord | <impbox [ftsf]> https://play.nim-lang.org/#ix=4dys |
09:39:12 | FromDiscord | <Generic> Arrays are guaranteed to lie linearly in memory so you can just do isize(T) whereas T is the element type |
09:40:04 | FromDiscord | <Generic> Add that to the offset of the array object member |
09:43:57 | arkanoid | can I use a template to generate function with generic parameters? |
09:44:19 | arkanoid | what comes first, template expansion or generic function generation? |
09:44:23 | FromDiscord | <impbox [ftsf]> In reply to @Generic "Add that to the": hmm yes... i can nearly do it i think, i just need to figure out the sizeof the member of the array |
09:45:03 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4dyz |
09:45:33 | FromDiscord | <impbox [ftsf]> `Error: identifier expected` |
09:46:32 | FromDiscord | <impbox [ftsf]> how can i get the type of an array member? |
09:50:43 | FromDiscord | <impbox [ftsf]> typetraits' elementType seems useful |
09:52:52 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4dyD |
09:53:01 | FromDiscord | <Generic> You can just do either t.m.T or typeof(t.m).T |
09:53:37 | FromDiscord | <Generic> Like with any generic object you can retrieve the parameters |
09:54:18 | FromDiscord | <impbox [ftsf]> undeclared field typeof(t.m).T -> undeclared field T |
09:55:49 | FromDiscord | <Generic> What about the other one? |
09:56:18 | FromDiscord | <impbox [ftsf]> same |
09:56:34 | FromDiscord | <Generic> Weird |
09:57:00 | FromDiscord | <Generic> Maybe it doesn't work because it's a builtin type |
09:57:18 | FromDiscord | <Generic> sizeof(typeof(t.m)) |
09:57:30 | FromDiscord | <Generic> Should work though |
09:57:55 | FromDiscord | <impbox [ftsf]> it does, but it doesn't tell me the size of the elements |
09:58:02 | FromDiscord | <impbox [ftsf]> unless i can get the number of elements and divide |
09:58:39 | arkanoid | I've closed vs studio and now I'm using basic text editor, but "nimble build" fills ram (32GB) and crash everything |
09:58:51 | FromDiscord | <Generic> Eh I meant sizeof(typeof(t.m[0])) |
09:59:06 | * | xet7 joined #nim |
09:59:25 | FromDiscord | <Generic> And you can get the length of the array with len |
09:59:28 | FromDiscord | <impbox [ftsf]> nah can't do `t.m[0]` identifier expected |
09:59:38 | FromDiscord | <Generic> Oh wait |
09:59:58 | FromDiscord | <Generic> You're doing this in a template |
09:59:59 | FromDiscord | <impbox [ftsf]> `sizeof(t.m) div t.m.len` works |
10:00:13 | FromDiscord | <impbox [ftsf]> yup, doing this in a template |
10:00:35 | FromDiscord | <vindaar> arkanoid\: https://play.nim-lang.org/#ix=4dyF |
10:00:43 | FromDiscord | <impbox [ftsf]> playground down |
10:00:56 | arkanoid | playground down |
10:01:11 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4dyI |
10:01:57 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4dyJ |
10:02:20 | FromDiscord | <Generic> ah |
10:02:28 | FromDiscord | <Generic> t is a typedesc and not |
10:02:32 | FromDiscord | <Generic> a concrete variable |
10:02:46 | FromDiscord | <Generic> ok, now I know why my stuff didn't work earlier |
10:03:02 | FromDiscord | <impbox [ftsf]> though i just realised my problem is more complex, since I actually want↵`offsetOf(Foo, bar[0].baz)` |
10:03:07 | FromDiscord | <impbox [ftsf]> (edit) "bar[0].baz)`" => "bar[3].baz)`" |
10:03:25 | FromDiscord | <Generic> just add the offsetof from array type again onto it |
10:04:19 | FromDiscord | <impbox [ftsf]> yep, maybe a macro would work better |
10:04:38 | FromDiscord | <Generic> idk if you have to do this really often, that might be warrented |
10:04:50 | FromDiscord | <impbox [ftsf]> mmm hopefully not =) |
10:05:02 | FromDiscord | <impbox [ftsf]> i'll just make a hacky solution for this one case |
10:05:10 | FromDiscord | <Generic> ah there's another way |
10:05:29 | FromDiscord | <Generic> you can technically also just subtract the pointer of the the element from the pointer of the start |
10:05:41 | FromDiscord | <Generic> (edit) "element" => "field" |
10:05:59 | FromDiscord | <Generic> only then you're responsible for the fact that there's no implicit deref somewhere |
10:06:03 | FromDiscord | <Generic> because then you'll get bogus sizes |
10:06:47 | FromDiscord | <impbox [ftsf]> yeah, i'd be happy to do that, except it's referring to types not instances |
10:06:56 | FromDiscord | <impbox [ftsf]> maybe i can just make a fake instance and use that to get the offsets |
10:08:54 | arkanoid | vindaar, that was the problem, also T and J are Tesla and Joule |
10:12:24 | FromDiscord | <vindaar> yeah, but for those the compiler isn't confused (for some reason). It's only `static` that it doesn't like |
10:14:03 | arkanoid | no, it get confused too, I had to replace them to make your example work |
10:14:24 | arkanoid | it was clearly complaning for some Joule and Tesla thing, which are not really into my logic |
10:14:57 | arkanoid | this compiles and run https://play.nim-lang.org/#ix=4dyO |
10:16:31 | FromDiscord | <vindaar> huh, it worked locally for me. |
10:16:31 | FromDiscord | <vindaar> which nim version are you on? |
10:17:43 | arkanoid | 1.6.8 |
10:19:41 | arkanoid | it works! thanks, this saved a ton of boilerplate code |
10:21:00 | FromDiscord | <vindaar> maybe it's something that was fixed in devel then? Or my code was too simple. Anyway, glad it works |
10:28:06 | arkanoid | I'm facing "nimble build" that fills 32GB and ram and crashes everything. What0s wrong with https://play.nim-lang.org/#ix=4dyS ? |
10:32:38 | arkanoid | it's due to openArray. If I use seq as argument it doesn't behave that way |
10:46:42 | arkanoid | I have to deal with array * seq ops, and seq * array ops, this would be the perfect fit for openArray, but if I use it, nimble build goes loop |
11:01:01 | FromDiscord | <vindaar> arkanoid\: just added \~all trigonometric functions to measuremancer and some tests & CI https://github.com/SciNim/Measuremancer/pull/3 |
11:01:20 | arkanoid | hooray! |
11:04:26 | arkanoid | I'm trying to extract from my code the minimal example that makes compilator go loop |
11:12:25 | * | arkurious joined #nim |
11:18:16 | arkanoid | vindaar: can you explain this? With `when` to false, code compiles and runs correctly, with `when` to true, compiler goes loop. I suggest you to don't paste this into anything that would run nim check or run compilation automatically. I thing it would crash play.nim-lang too https://play.nim-lang.org/#ix=4dz0 |
11:18:37 | arkanoid | if you nim c from command line, you can just ctrl-c before it fills your ram |
11:28:57 | arkanoid | here's a possible way to better understand what's going on withou unchained in the equation https://play.nim-lang.org/#ix=4dz2 , why compiler wants to run function in "when" block ? |
11:33:17 | FromDiscord | <Bung> @ElegantBeef https://github.com/nim-lang/Nim/pull/20597 how about this ? the const closure thing |
11:44:39 | * | jmdaemon quit (Ping timeout: 252 seconds) |
12:30:33 | arkanoid | solved |
12:35:36 | FromDiscord | <vindaar> arkanoid\: I was afk. How did you solve it? And was it specific to `collect`? |
12:51:48 | arkanoid | vindaar, I've fixed the recursive compilation problem by setting :not openarray on type arguments https://play.nim-lang.org/#ix=4dzG |
12:51:59 | arkanoid | vindarr, but I'm fighting with your code |
12:52:12 | arkanoid | macro `*`*[T: SomeUnit|SomeNumber; U: SomeUnit|SomeNumber](x: T; y: U): untyped = |
12:52:44 | FromDiscord | <vindaar> what's the issue? |
12:54:22 | arkanoid | this macro is called in place of mine "func `operator` *[??L: not openArray, ??R: not openArray](a: openArray[??L], b: ??R): auto =" when I try to seq[UnitLess] * m^2 |
12:55:29 | arkanoid | I'm getting unchained/units.nim(298, 29) * Error: Unsupported : ntySequence |
12:56:00 | arkanoid | question is why T: SomeUnit|SomeNumber selects seq[UnitLess] |
13:00:54 | * | derpydoo joined #nim |
13:01:58 | FromDiscord | <vindaar> oh... I see. `SomeUnit` is a concept. When the compiler tries to resolve the overloads it checks the concept. As the concept is rather complicated (it calls a macro itself) this happens. The reason is that I don't handle `seq[SomeUnit]` apparently \:) |
13:01:58 | FromDiscord | <vindaar> (in general it shouldn't ever cause a CT error like this of course, the concept should simply not match) |
13:04:15 | FromDiscord | <vindaar> can you open an issue with a reproducible code snippet? |
13:06:26 | arkanoid | doing now |
13:07:18 | arkanoid | vindaar: https://play.nim-lang.org/#ix=4dzP |
13:07:56 | arkanoid | surely the problem lives between concept and my effort in trying to not match openArray[openArray[..]] |
13:09:27 | arkanoid | actually, it don't work even if I remove the template limiters: https://play.nim-lang.org/#ix=4dzQ |
13:09:57 | arkanoid | *generic arguments limiter .. do they have a proper name? I'm making them up |
13:15:18 | FromDiscord | <vindaar> that code runs fine for me |
13:15:29 | FromDiscord | <vindaar> I have a few small changes locally in unchained though |
13:15:41 | FromDiscord | <vindaar> (but those should be unrelated) |
13:16:47 | FromDiscord | <vindaar> ah |
13:16:52 | FromDiscord | <vindaar> can confirm, it's my local fixes |
13:16:57 | FromDiscord | <vindaar> will make a PR and tag a new release |
13:18:07 | arkanoid | here the error I am getting: https://play.nim-lang.org/#ix=4dzV |
13:18:37 | arkanoid | oh! good! glad to have found something |
13:19:35 | arkanoid | the difference is just seq, if I turn a into an array "a = [1.UnitLess, 2.UnitLess, 3.UnitLess]" my func gets called and it works correctly |
13:21:28 | NimEventer | New Nimble package! measuremancer - A library to handle measurement uncertainties, see https://github.com/SciNim/Measuremancer |
13:24:11 | * | CyberTailor joined #nim |
13:26:39 | arkanoid | *tiny dance for measuremancer* |
13:27:56 | * | m5zs7k quit (Ping timeout: 260 seconds) |
13:34:25 | * | m5zs7k joined #nim |
13:44:23 | FromDiscord | <vindaar> tagged a new unchained version. let me know if it fixes the problem for you |
13:47:51 | * | derpydoo quit (Ping timeout: 268 seconds) |
13:50:57 | arkanoid | vindaar, I'll try it right now |
13:51:24 | arkanoid | side question: is there a "stack only" table in nim? |
13:55:27 | arkanoid | vindaar, it works! :) |
13:55:36 | arkanoid | I can continue my run towards the goal |
13:57:18 | FromDiscord | <vindaar> nice! let's hope it'll be longer before the next bug 🙈 |
14:00:41 | PMunch | Just saw measuremancer and unchained, cool libraries! |
14:13:51 | FromDiscord | <albassort> can i write a kernel module in nim |
14:13:54 | FromDiscord | <albassort> (edit) "nim" => "nim?" |
14:13:59 | FromDiscord | <albassort> will GC work? |
14:14:26 | * | PMunch quit (Quit: Leaving) |
14:15:26 | arkanoid | vindaar, is it considered a feature that "(5.m * 3.ft^-1) = 15 Meter*Foot^-1" ? |
14:16:09 | arkanoid | shouldn't this operation result in an UnitLess with a feature conversion towards SI? |
14:17:45 | FromDiscord | <vindaar> yes and no. In the past imperial units were always converted if they were multiplied / divided with SI units. When I did the big rewrite to generate things from declarative macros, I added the option to avoid auto conversion for some types. The idea was that if one has e.g. one imperial mixed with other units, possibly the imperial should remain. ↵However, the case you mention (both same quantities), should normally be converted, yes. T |
14:18:31 | * | hochata joined #nim |
14:20:05 | FromDiscord | <vindaar> you can force the conversion for now using `.to(UnitLess)`. I'll note it down |
14:20:25 | arkanoid | well, the conversion is not happening right now |
14:20:32 | arkanoid | I've also noticed another thing |
14:22:07 | arkanoid | 5.m^2*m^-3 * 2.m^-1 says Error: type mismatch: got <Meter^-1> |
14:22:51 | arkanoid | I know that they are technically the same, but the handling should be automatic here, or not? |
14:25:03 | FromDiscord | <vindaar> not sure I understand this case |
14:28:00 | arkanoid | wait, I'm trying to replicate in an self contained example, but I'm failing so far, so it might just be a defUnit problem |
14:31:04 | * | CyberTailor left #nim (Konversation terminated!) |
14:43:16 | * | rockcavera joined #nim |
14:43:16 | * | rockcavera quit (Changing host) |
14:43:16 | * | rockcavera joined #nim |
14:47:58 | * | derpydoo joined #nim |
14:57:41 | * | rez joined #nim |
14:58:58 | FromDiscord | <vindaar> ok, think I fixed it |
15:11:02 | FromDiscord | <Andycol> What is the best way to create a stdin prompt↵example it says whats your name? and you enter bob then turns the result into a variable called $name |
15:11:53 | FromDiscord | <MrOkram> sent a code paste, see https://play.nim-lang.org/#ix=4dAN |
15:14:04 | * | kenran` quit (Remote host closed the connection) |
15:18:41 | * | fanta1 joined #nim |
15:20:37 | FromDiscord | <MrOkram> Usually in other languages, like Java for example, i'd just put `\"` and be done with it, but here as can be seen that doesn't work, even tho on the Nim Wiki it says `\` is used for escaping chars. https://media.discordapp.net/attachments/371759389889003532/1032312322066227231/unknown.png |
15:25:59 | FromDiscord | <Generic> command invocations with no brackets and no space like re"blahaha" have a special rule |
15:26:08 | FromDiscord | <Tanguy> `re("\"xxx)` |
15:26:12 | FromDiscord | <Tanguy> (edit) "`re("\"xxx)`" => "`re("\"xxx")`" |
15:26:37 | FromDiscord | <Generic> either that or write it how it is but with no \ |
15:26:53 | FromDiscord | <Generic> (edit) "either" => "~~either" | "no \" => "~~" |
15:27:19 | FromDiscord | <Generic> that doesn't work for ", only for \ |
15:27:47 | FromDiscord | <Generic> do what Tanguy said, or use """triple quotes""" |
15:28:57 | FromDiscord | <MrOkram> Yup, did, this turned out to work `re("\"[\\W\\w\\D\\d]")`, had to double `\`. |
15:29:06 | FromDiscord | <MrOkram> Thanks for help |
15:30:05 | FromDiscord | <Tanguy> Maybe triple quotes are indeed better then, you won't have to escape anything↵https://nim-lang.org/docs/manual.html#lexical-analysis-triple-quoted-string-literals |
15:31:04 | FromDiscord | <MrOkram> In reply to @Tanguy "Maybe triple quotes are": Perhaps, but i find the `\\` much easier to read somehow. |
15:34:45 | FromDiscord | <Elise_Wang> sent a long message, see http://ix.io/4dzS |
15:35:55 | FromDiscord | <MrOkram> Well that's a bot |
15:57:14 | * | wallabra quit (Ping timeout: 268 seconds) |
15:58:49 | * | wallabra joined #nim |
16:08:32 | FromDiscord | <jos> In reply to @albassort "can i write a": ORC probably works |
16:08:50 | FromDiscord | <jos> they all probably work but ORC makes the most sense for a kernel module |
16:09:03 | FromDiscord | <jos> if you have to use GC, anyway |
16:09:35 | FromDiscord | <albassort> i would need strutils or program my own manual memory managed version |
16:09:43 | FromDiscord | <vindaar> arkanoid\: fix incoming https://github.com/SciNim/Unchained/pull/30 |
16:12:00 | FromDiscord | <albassort> In reply to @jos "if you *have* to": still tying to figure out how i'd make it work on a kernel level omo |
16:12:49 | FromDiscord | <albassort> i would like for it to sit on the end of the input pipe |
16:15:05 | FromDiscord | <jos> dunno, follow a nim on a microcontroller tutorial for bare metal and then fill in the delta |
16:15:18 | FromDiscord | <jos> probably the best route |
16:17:05 | FromDiscord | <jos> nim does compile to C, so you can inspect the output and work backwards from there too |
16:25:29 | FromDiscord | <vindaar> arkanoid\: new version is tagged. Hope this is it for now 😁 |
16:27:34 | * | hochata quit (Ping timeout: 268 seconds) |
16:27:54 | FromDiscord | <ringabout> Hello, vindaar. What was I missing for measuremancer? https://github.com/nim-lang/Nim/pull/20599 |
16:28:45 | FromDiscord | <ringabout> https://github.com/nim-lang/Nim/actions/runs/3281886210/jobs/5404528015 |
16:29:33 | FromDiscord | <ringabout> It seems that I cannot switch to the right directory or something. |
16:29:42 | FromDiscord | <ringabout> > /home/runner/work/Nim/Nim/pkgstemp/measuremancer/tests/tmeasuremancer.nim(1, 8) Error: cannot open file: measuremancer |
16:30:19 | FromDiscord | <vindaar> that's rather weird |
16:30:29 | FromDiscord | <ringabout> I cannot use cd either |
16:30:33 | FromDiscord | <ringabout> > Failure: reInstallFailed↵> cd measuremancer↵> /bin/sh: 1: cd: can't cd to measuremancer |
16:30:37 | arkanoid | vindaar, sorry I was in a coding rush. Downloading the second daily update right now |
16:30:56 | arkanoid | vindaar, is it always true that UnitLess * float -> float ? |
16:31:06 | FromDiscord | <vindaar> I mean the main file in this case is in the root directory of the package. But that shouldn't be a problem I would have guessed |
16:31:11 | arkanoid | or float * UnitLess -> float |
16:31:35 | FromDiscord | <vindaar> but I don't quite know how the important packages logic works |
16:31:50 | FromDiscord | <ringabout> In reply to @vindaar "I mean the main": can you add a config file for switching path or using relative path for tests? |
16:31:56 | FromDiscord | <vindaar> `UnitLess` is for all practical purposes just an alias to `float`. There are converters for it↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
16:32:27 | FromDiscord | <vindaar> ah!↵(@flywind) |
16:32:56 | FromDiscord | <vindaar> the package isn't actually installed, is it? so that in code `import measuremancer` doesn't work, right? |
16:32:56 | FromDiscord | <ringabout> I suppose that measuremancer are not installed globally. |
16:33:11 | FromDiscord | <ringabout> Yeah, it gets cloned |
16:34:48 | FromDiscord | <vindaar> pushing a fix now |
16:34:48 | FromDiscord | <ringabout> In reply to @vindaar "the package isn't actually": Yeah, |
16:34:53 | FromDiscord | <ringabout> thank you |
16:35:01 | FromDiscord | <vindaar> https://github.com/SciNim/Measuremancer/pull/4 |
16:37:57 | FromDiscord | <vindaar> tagged a new version. let's see if that fixes it |
16:43:29 | * | PMunch joined #nim |
16:43:52 | arkanoid | idiomatic way to concat two arrays at compile time? |
16:45:20 | PMunch | &? |
16:45:31 | PMunch | Wait, that doesn't work does it |
16:47:14 | PMunch | I guess `var res: array[x.len + y.len, typeof(x[0])]; res[0..x.high] = x; res[x.len..^1] = y` might work? |
16:48:08 | arkanoid | & doesn't work. Ok so I guess I have to write my own |
16:49:12 | PMunch | My second suggestion does work: https://play.nim-lang.org/#ix=4dBb |
16:49:44 | arkanoid | PMunch: thanks! yeah I was testing myself |
16:49:51 | arkanoid | lets see if I can wrap it into a function |
16:50:31 | Amun-Ra | what if one wants const? :> |
16:51:21 | Amun-Ra | → https://play.nim-lang.org/#ix=4dBc |
16:52:38 | arkanoid | to make it work at runtime I think I need to make it generic and bake a different version for each different couple of lengths |
16:52:46 | PMunch | Amun-Ra, https://play.nim-lang.org/#ix=4dBd |
16:52:56 | PMunch | Or that, yeah |
16:53:17 | Amun-Ra | PMunch: nice one |
16:53:26 | PMunch | arkanoid, yes, Nim arrays are compile-time defined length, so you'd need to do it that way |
16:53:37 | Amun-Ra | I'm stealing it |
16:53:48 | PMunch | Or make a wrapper to a function which just took a pointer and length and used memcpy |
16:53:56 | PMunch | Or copyMem or whatever it is in Nim :P |
17:04:18 | arkanoid | it works! https://play.nim-lang.org/#ix=4dBg |
17:07:08 | Amun-Ra | how long play.nim pastes are alive? |
17:07:35 | PMunch | As long as ix.io keeps them alive |
17:07:43 | PMunch | Seems to be a couple years at least |
17:08:02 | Amun-Ra | hmm |
17:08:37 | PMunch | arkanoid, why do you use the paragraph symbol for generic variables? |
17:08:40 | PMunch | Just curious |
17:08:45 | PMunch | Amun-Ra, how so? |
17:08:52 | PMunch | It might be based on how often they are accessed |
17:09:15 | PMunch | I had a script on my old work computer which constantly checked an ix.io paste to see if it was still the same |
17:09:20 | PMunch | And it lasted for years |
17:09:34 | Amun-Ra | PMunch: IIRC my few months old pastes are gone, I have to test that |
17:10:13 | PMunch | I just went back in the IRC log for this chat room, exactly two years ago and found an old paste link there |
17:10:30 | PMunch | Didn't bother to check if the content made sense in context, but it was at least Nim code |
17:10:42 | Amun-Ra | hmm |
17:15:06 | * | derpydoo quit (Ping timeout: 264 seconds) |
17:19:59 | arkanoid | PMunch: because I'm using unchained package, which exports a lot of types like N for Newton, T for Tesla, J for Joule and so on. So instead of playing which letter is good, I've added an uncommon prefix |
17:20:38 | PMunch | Aaah, I see |
17:26:20 | * | derpydoo joined #nim |
17:27:12 | FromDiscord | <Schelz> is possible to create proc inside a class ? And the procs to return smth when are called ? |
17:27:16 | FromDiscord | <Schelz> (edit) "?" => "." |
17:27:58 | PMunch | @Schelz, we don't really have classes in Nim |
17:28:25 | FromDiscord | <Schelz> oh ok 😅 |
17:28:28 | PMunch | Unless of course you use something like this: https://github.com/jjv360/nim-classes |
17:28:43 | PMunch | Not quite sure what you're trying to achieve |
17:29:33 | PMunch | But typically in Nim you have a type, and a proc which takes that type as the first argument. Because of the unified call syntax you can then do stuff like `myinstance.myprocedure()` |
17:29:55 | PMunch | And of course then you can use the argument like you normally would |
17:31:10 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=4dBh |
17:31:19 | FromDiscord | <Schelz> and to be able to call the class functions as types for other porc |
17:31:30 | FromDiscord | <Schelz> (edit) "porc" => "func" |
17:33:02 | PMunch | Something like this? https://play.nim-lang.org/#ix=4dBi |
17:34:50 | FromDiscord | <Schelz> yeah |
17:37:21 | FromDiscord | <Schelz> thx |
17:37:57 | PMunch | No problem |
17:38:17 | PMunch | Note that the star there is the "public" modifier. That exports the procedure out of the current module |
17:38:29 | PMunch | Without it you would only be able to call the procedure from the current module |
17:38:45 | FromDiscord | <Schelz> got it |
17:38:54 | FromDiscord | <Schelz> (edit) "got it ... " added "👍" |
17:41:18 | PMunch | If you want to change the object you need to change the type it takes to `var MyClass` |
17:41:25 | PMunch | And give it a name other than _ of course |
17:47:05 | * | PMunch quit (Quit: leaving) |
17:48:57 | * | rez quit (Quit: much snoozes...) |
17:50:11 | * | reversem3[m] left #nim (#nim) |
17:58:49 | arkanoid | what's the correct way to cast an array to a different compatible type? eg type A = float; type B = float; then convert array[5,A] in array[5,B] without copy |
17:59:13 | arkanoid | do I have to use the cast cannon or is there a gentle way to get there? |
18:00:28 | FromDiscord | <Rika> Am I reading it right? A and B are both float? |
18:00:36 | FromDiscord | <Rika> They’re the same type |
18:00:37 | arkanoid | yes |
18:00:48 | FromDiscord | <Rika> There’s nothing to convert? |
18:01:09 | arkanoid | actually distinct float types |
18:01:16 | arkanoid | but yeah, no value has to be changed |
18:03:48 | * | kenran joined #nim |
18:15:07 | FromDiscord | <blashyrk> Is there a way to get "out" of a genAst temporarily in order to, for example, loop through a static seq and add NimNodes based on that?↵↵Alternatively, is there a way to "trust me bro" a call to newCall from within a compile time proc and pass an ident that doesn't exist in the current scope/context into the call (that will definitely exist at the place that call node is actually used)? |
18:24:11 | FromDiscord | <Horizon [She/Her]> Is the `arc`/`orc` memory management modes suitable for an embedded device? Also what's the difference between `arc` and `orc`? |
18:32:25 | FromDiscord | <Tanguy> Arc is suitable, orc is arc + stack scanning to detect cyclic references↵So arc by itself won't be able to free cyclic references |
18:49:33 | * | kenran quit (Remote host closed the connection) |
19:11:08 | * | xet7 quit (Remote host closed the connection) |
19:26:13 | * | rez joined #nim |
19:54:57 | NimEventer | New thread by mantielero: Some help with javascript - OpenCascade.js, see https://forum.nim-lang.org/t/9535 |
20:01:27 | FromDiscord | <auxym> In reply to @Event Horizon "Is the `arc`/`orc` memory": what tanguy said, and yes, ARC is the best suited MM for #embedded systems |
20:02:27 | FromDiscord | <Elegantbeef> You generally dont need cyclical types on embedded luckily 😄 |
20:05:58 | FromDiscord | <Generic> {.cursor.} and a bit of care you can have cyclic data structures with no problems on ARC |
20:10:59 | FromDiscord | <Horizon [She/Her]> Ah alright thanks! |
20:12:31 | qwr | btw, what kind of embedded - the ARC keeps memory usage lower and has lower maximum pauses, but on many "embedded" platforms even refc might do well enough, and i would say that ARC/ORC still has some bugs |
20:14:31 | qwr | on something like arduino or ESP32 the difference matters, but if you have like 64MB memory and ARM, then probably not |
20:16:06 | FromDiscord | <Elegantbeef> line 35 in the test is should compile, but yea the error is 'close' though it should be like "Compile time closures with an environment cannot be used at runtime" or similar↵(@Bung) |
20:20:01 | FromDiscord | <Bung> @ElegantBeef you mean 35 should not report error ? |
20:20:33 | FromDiscord | <Elegantbeef> Like araq said that closures without environments should work from constants |
20:21:00 | FromDiscord | <Elegantbeef> The issue right now is that the compiler doesnt go "Hey this is a static closure, do not statically evaluate" |
20:21:46 | FromDiscord | <Bung> 34, 35 are nearly same place |
20:22:30 | FromDiscord | <Elegantbeef> Both of the first tests should compile |
20:22:31 | FromDiscord | <Bung> oh , so they are both valid. |
20:22:57 | FromDiscord | <Elegantbeef> Correct, the idea is that if there is no closure environment it's just a pointer proc that uses the closure calling convention for convience |
20:23:55 | FromDiscord | <Bung> after this I need handle assignment or put in array construction |
20:24:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dBT |
20:25:09 | FromDiscord | <Elegantbeef> Presently if you do `a()` or `b()` the static folding part of the compiler goes "Oh a is a constant" and attempts to call it at compile time |
20:25:33 | FromDiscord | <Elegantbeef> Which is clearly wrong, which means there needs to be a check to ensure the proc is not a static variable in the static folding |
20:26:32 | FromDiscord | <Elegantbeef> When it comes to constant procs that are invoked outside of `static` the correct thing to do is to emit a call at runtime, but that doesnt happen so the VM errors |
20:27:14 | FromDiscord | <Bung> wait, how 35 complies , `VM problem: dest register is not set` this is existed error |
20:28:08 | FromDiscord | <Elegantbeef> It's supposed to compile, that's a bug that i'm talking about |
20:28:09 | FromDiscord | <Bung> or maybe not , just cause by my modification. |
20:28:30 | FromDiscord | <Elegantbeef> That error appears due to the compiler seeing a constant expression and attempting to optimise |
20:28:40 | * | fanta1 quit (Quit: fanta1) |
20:28:47 | FromDiscord | <Bung> so it's another bug ? |
20:29:02 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/semexprs.nim#L869 is the culrpit |
20:29:05 | FromDiscord | <Elegantbeef> culprit even |
20:29:21 | FromDiscord | <Elegantbeef> it needs a `callee.kind != skConst and (a or b)` |
20:29:41 | FromDiscord | <Bung> okay, I consider fix that. |
20:29:56 | FromDiscord | <Elegantbeef> With that change `b()` does compile |
20:30:01 | FromDiscord | <Elegantbeef> But `a()` still does not |
20:30:04 | FromDiscord | <Bung> I understand now, it shouldn't treate as StaticExpr |
20:30:40 | FromDiscord | <Elegantbeef> Yep the symbol is static so it attempts to run it on the VM which is wholly incorrect as it's not called in a static context |
20:31:25 | FromDiscord | <Elegantbeef> I dont even know if the `sfNoSideEffect` makes sense |
20:31:34 | FromDiscord | <Bung> okay, thank you, I think I'll get more bug fix point |
20:31:44 | FromDiscord | <Elegantbeef> Given that you can have a procedure marked no side effect but have side effects inside |
20:54:31 | arkanoid | how do you keep your git/other versioning nim project folder tidy from all the nim binaries that tends to be created here and there during daily work? |
20:54:58 | arkanoid | do you ignore them all, delete them all manually, or you have a better strategy? |
20:55:33 | FromDiscord | <huantian> make one folder for all your binaries that you ignore |
20:56:13 | arkanoid | huantian, how you do that? config.nims? |
20:56:38 | FromDiscord | <huantian> huh you might be able to do that with config.nims, I just have it configured with vscode launch options |
20:56:46 | FromDiscord | <huantian> or I'm using `nix` and it puts stuff in `./result` |
20:56:57 | FromDiscord | <huantian> config.nims might actually work tho |
20:57:24 | arkanoid | how comes nix handles this? isn't nix just providing nim shell as-is? |
20:58:09 | FromDiscord | <huantian> yeah if i'm testing im either going into a nix shell, which doesn't make any binaries↵or i'm building it with `nix build`, which only puts stuff in `./result/` |
20:58:19 | FromDiscord | <Elegantbeef> Or just ignore all binaries↵(@huantian) |
20:58:58 | FromDiscord | <Elegantbeef> Manually export the code and make an accompany header or use treeform's genny↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
20:59:43 | FromDiscord | <Patitotective> In reply to @arkanoid "how do you keep": i use this to ignore all files without extension https://github.com/Patitotective/kdl-nim/blob/main/.gitignore |
21:00:28 | FromDiscord | <Patitotective> you can also just add `--outdir:bin` to your config.nims |
21:04:03 | arkanoid | I'm trying with --outdir: <abspath> but seems not working |
21:04:27 | FromDiscord | <Rika> if you are using nimble build it will not pass the parameters from command line |
21:04:30 | FromDiscord | <Rika> use a config file |
21:04:55 | arkanoid | I have config.nims in project root |
21:05:06 | arkanoid | ok I see it does work with nim c, but not nimble |
21:05:12 | arkanoid | nimble has it's own setting |
21:21:00 | FromDiscord | <Patitotective> In reply to @PMunch "Is there a way": https://nim-lang.org/docs/os.html#getAppDir |
21:24:24 | FromDiscord | <Esther> sent a code paste, see https://play.nim-lang.org/#ix=4dC4 |
21:24:29 | FromDiscord | <Esther> I don’t know the proper syntax |
21:25:50 | FromDiscord | <Esther> sent a code paste, see https://play.nim-lang.org/#ix=4dC6 |
21:26:14 | FromDiscord | <Esther> And then you can use either Thing or Any_Thing as a function parameter to communicate whether you handle the nothing case |
21:26:23 | FromDiscord | <Esther> Or return value etc |
21:26:36 | FromDiscord | <Esther> I probably got some syntax wrong, I’m on my phone |
21:26:53 | FromDiscord | <Esther> (edit) "https://play.nim-lang.org/#ix=4dC6" => "https://play.nim-lang.org/#ix=4dC7" |
21:28:13 | FromDiscord | <Esther> Importantly the derived type is a subtype of the parent one, i.e not distinct and can happily be converted |
21:38:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dCc |
21:38:57 | FromDiscord | <Esther> That looks like it’d work, nifty |
21:39:38 | FromDiscord | <Esther> It was @Arkanoid that wanted it though not me |
21:40:18 | FromDiscord | <Elegantbeef> `setCurrentDir(getAppDir())`↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
21:41:09 | FromDiscord | <Elegantbeef> Eh arc doesnt really have bugs. You generally dont really need a cyclic collector on embedded though |
21:41:39 | FromDiscord | <Elegantbeef> Embedded most mean is generally microcontrollers so where you're memory and CPU limited heavily |
22:29:35 | * | jmdaemon joined #nim |
22:29:36 | arkanoid | is there a package to benchmark/time functions? |
22:32:27 | FromDiscord | <Esther> Yes, I’ve been using one, nimbench I think? |
22:33:40 | FromDiscord | <Esther> Oh no, benchy |
22:33:43 | FromDiscord | <Esther> There are a bunch |
22:42:28 | * | hochata joined #nim |
22:57:18 | arkanoid | thanks! |
23:47:37 | FromDiscord | <Sabena Sema> I've been writing rust and boy I miss nim's "fake HKT" thing |
23:47:43 | * | rez quit (Quit: much snoozes...) |
23:48:01 | FromDiscord | <Sabena Sema> it's kinda funny that such a simple bit of syntax covers so many of the things people actually wanna use HKTs for |
23:55:28 | FromDiscord | <Elegantbeef> Doesnt rust have static generics? |
23:56:11 | FromDiscord | <Elegantbeef> I might not know what exactly a higher kinded type actually entails |