00:00:13 | FromDiscord | <Elegantbeef> You implement `getBounds` and it's a BoundObject |
00:00:26 | FromDiscord | <Elegantbeef> Concepts are user defined duck typing, it's that simple |
00:00:26 | nrds | <Prestige99> hm |
00:00:35 | * | krux02 quit (Remote host closed the connection) |
00:01:28 | nrds | <Prestige99> dang, was hoping it was slightly more robust |
00:02:33 | FromDiscord | <Elegantbeef> In what way? |
00:03:15 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3MQk |
00:03:19 | nrds | <Prestige99> I'm thinking more like an interface where I can simple say like, type Foo = object with concept BoundObject or some nonsense |
00:03:21 | FromDiscord | <Elegantbeef> Here's a basic example |
00:03:35 | FromDiscord | <Elegantbeef> You want interfaces |
00:04:05 | nrds | <Prestige99> well |
00:04:06 | FromDiscord | <ajusa> https://github.com/yglukhov/iface/ is good for interfaces |
00:04:09 | FromDiscord | <Elegantbeef> Or traits rather |
00:04:27 | FromDiscord | <Elegantbeef> I was considering at a point making a trait like system using concepts |
00:04:29 | nrds | <Prestige99> It would be nice to get a compiler error if I forgot to implement getBounds on the type, for instance |
00:06:06 | FromDiscord | <Elegantbeef> Yea there's not a mechanism that'd enable that |
00:06:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MQl |
00:06:57 | FromDiscord | <Elegantbeef> Manually placing that at the end of the module you implement the type in gets tedious |
00:07:26 | nrds | <Prestige99> suppose that could be put together with macros eh |
00:07:37 | FromDiscord | <Elegantbeef> Eh not really |
00:08:24 | FromDiscord | <Elegantbeef> You need to have an assertion at the end of a file to ensure that you've implemented a concept, but you cannot use a macro to add code to the end of a moduel |
00:09:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MQm |
00:10:09 | nrds | <Prestige99> interesting |
00:11:24 | FromDiscord | <Elegantbeef> So aside from manual assertions(which are less than useless since you might aswell just manually check once) you pretty much only have instantiation errors to protect you |
00:12:36 | FromDiscord | <Elegantbeef> I suppose you could make macro that uses the new concepts and annotate procedures and then in your main module have a `conceptCheck` |
00:14:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MQo |
00:15:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MQp |
00:16:43 | nrds | <Prestige99> well I think I'll just do the simple getBounds concept for now |
00:17:08 | FromDiscord | <Elegantbeef> Jeez have some fun play with macros! 😛 |
00:17:11 | nrds | <Prestige99> I hope they are cleaned up and expanded upon sooner rather than later, would be sweet to have something like an interface |
00:17:27 | nrds | <Prestige99> eh |
00:17:34 | nrds | <Prestige99> Macros are a pain haha |
00:36:54 | * | vicfred quit (Quit: Leaving) |
00:38:15 | nrds | <Prestige99> Is there a proc that adds an element to the front of a seq? |
00:45:40 | FromDiscord | <leorize> `insert` should do |
00:48:06 | nrds | <Prestige99> ah, thanks |
01:17:31 | FromDiscord | <Elegantbeef> prestige you know i cannot help myself https://play.nim-lang.org/#ix=3MQE |
01:18:05 | FromDiscord | <Elegantbeef> A few modifications can be done to ensure it matches and there are some issues if you have `var T` i guess |
01:18:28 | FromDiscord | <Elegantbeef> But it works so a PoC 😛 |
01:19:03 | arkanoid | are pure enums a better idiom? |
01:19:20 | FromDiscord | <Elegantbeef> Personally i prefer prefixes to pure but YMMV |
01:20:17 | FromDiscord | <zgasma> hi, I'm new to Nim and trying to nimify a c networking library that uses a lot of uint8 arrays to handle the data. What's the proper Nim way to handle that? Do I just convert to seq[uint8] somehow? |
01:20:32 | nrds | <Prestige99> was that supposed to compile beef? |
01:20:41 | FromDiscord | <Elegantbeef> It does compile on 1.6.0 |
01:20:50 | FromDiscord | <Elegantbeef> The playground is on 1.4.8 for whatever reason |
01:20:55 | FromDiscord | <Elegantbeef> What's the exact C code doing? |
01:20:59 | nrds | <Prestige99> oh, okay |
01:21:13 | FromDiscord | <Elegantbeef> You could use a `string` or `seq[uint8]` or `array[size, uint8]` |
01:21:31 | nrds | <Prestige99> that's awesome beef |
01:22:28 | FromDiscord | <Elegantbeef> There are a few things that could be done adding procedure types to the table so you can get exact read outs, might even be able to do that to avoid having to do the iteration |
01:22:39 | FromDiscord | <Elegantbeef> replace all `Self` with the type on subscription |
01:22:53 | FromDiscord | <Elegantbeef> then just use `sameType(a, b)` |
01:24:06 | FromDiscord | <Elegantbeef> That's actually probably the better idea, so might toy with it later to make it cleaner |
01:24:57 | nrds | <Prestige99> Would be neat if we could somehow make that part of the type declaration rather than invoking a macro manually |
01:25:10 | arkanoid | the manual sometimes splits enum values by `,` sometimes not, which one is nep1? |
01:25:18 | FromDiscord | <Elegantbeef> You cant really since you want a `sem` |
01:25:26 | FromDiscord | <Elegantbeef> i mean a `sym` |
01:25:40 | FromDiscord | <zgasma> @Clonkk it's passing a uint8[] into read and then basically casting that into a union. I can figure out the fiddely bits, but I didn't want to miss any nimisms that might make that sort of thing easier. |
01:26:09 | FromDiscord | <Elegantbeef> there are no typed typedef macros sadly |
01:26:43 | FromDiscord | <Elegantbeef> You'd basically do the same thing in Nim |
01:27:01 | FromDiscord | <Elegantbeef> Do you have an example of the C code? |
01:27:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MQI |
01:28:14 | FromDiscord | <Elegantbeef> But yea ideally it'd support `type MyObj {.impl: BoundObject.}` |
01:29:19 | FromDiscord | <zgasma> I mean, here's a hunk that probably illustrates what I'm trying to do: https://git.sr.ht/~ft/c9/tree/master/item/c9.c#L418 |
01:30:39 | FromDiscord | <Elegantbeef> Now if only that was readable C |
01:31:32 | FromDiscord | <zgasma> haha...yes. This is actually a simpler implementation of the 9p protocol...which is why I'd prefer to have it in Nim ;) |
01:32:33 | * | adigitoleo joined #nim |
01:34:01 | FromDiscord | <Elegantbeef> I'd argue it's better to refer to the manpages than that code |
01:35:23 | FromDiscord | <zgasma> probably true. It's all kind of old-style C, even the descriptions in the man pages. I'll keep plugging away at it, though. |
01:35:36 | FromDiscord | <zgasma> gotta bail, but thanks for your help |
01:35:39 | FromDiscord | <Elegantbeef> http://man.cat-v.org/plan_9/5/stat well this is more readable and helps more imo than that C code |
01:35:52 | FromDiscord | <Elegantbeef> I dont get why they dont just make a struct for this though |
01:36:22 | FromDiscord | <Elegantbeef> Buh bye, i didnt do anything 😛 |
01:36:57 | FromDiscord | <zgasma> eh...you at least let me know that there wasn't some "well, duh. Just do it this way" thing that I was missing. |
01:50:46 | * | rockcavera quit (Remote host closed the connection) |
01:51:29 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MQL |
01:51:35 | FromDiscord | <Patitotective> (edit) |
01:51:43 | FromDiscord | <Elegantbeef> New line |
01:52:06 | FromDiscord | <Patitotective> Before `.. code-block::`? |
01:52:08 | FromDiscord | <Elegantbeef> and you may want `.. code-block:: Nim` |
01:52:11 | FromDiscord | <Elegantbeef> Yes |
01:53:09 | FromDiscord | <Patitotective> 👍 |
02:01:04 | FromDiscord | <Patitotective> A question: why does _Nim_'s _DocGen_ uses _rst_ instead of _Mardown_? |
02:01:37 | FromDiscord | <Patitotective> (edit) "uses" => "use" |
02:02:46 | FromDiscord | <Patitotective> _Mardown_ code blocks and links looks clearer to me |
02:02:48 | FromDiscord | <Rika> because rst is more "rich" than markdown? |
02:03:37 | FromDiscord | <Patitotective> In reply to @Rika "because rst is more": there should be a _Markdown_ only _DocGen_, for the people who don't actually need the _rst_ rich features |
02:03:46 | FromDiscord | <Rika> that is extra maintenance cost |
02:04:18 | FromDiscord | <Elegantbeef> Nimibook and nimib exist if you want MD nim code |
02:04:45 | FromDiscord | <Elegantbeef> It doesnt work with the Nim doc gen tooling but it does allow Nim + docs |
02:05:18 | FromDiscord | <leorize> Araq wants `:idx:`, yes, that is the only reason \:P↵(@Patitotective) |
02:05:58 | FromDiscord | <leorize> btw the docgen is a hybrid and can understand MD syntax, too |
02:07:05 | FromDiscord | <Patitotective> In reply to @leorize "btw the docgen is": code blocks and links? |
02:07:26 | FromDiscord | <Patitotective> (edit) "In reply to @leorize "btw the docgen is": ... code" added "fenced" |
02:07:50 | FromDiscord | <leorize> it can do code blocks the last time I checked |
02:09:04 | FromDiscord | <Patitotective> In reply to @leorize "it can do code": Oh :awesome: |
02:14:14 | FromDiscord | <Elegantbeef> Prestige we have an even fancier impl! https://play.nim-lang.org/#ix=3MQO |
02:14:32 | FromDiscord | <Elegantbeef> This one should work with `var Self` but i didnt test 🙂 |
02:17:12 | nrds | <Prestige99> oh nice |
02:17:38 | nrds | <Prestige99> should just make our own implementation of concepts... |
02:18:15 | FromDiscord | <Elegantbeef> Eh i'm too dumb to do that |
02:18:49 | FromDiscord | <Elegantbeef> Stuff like this is the big benefit of the new concept impl though |
02:18:55 | FromDiscord | <Elegantbeef> It's easy as hell to use macros on it |
02:21:38 | arkanoid | if an object field and a proc have the same name, how can I control which one is used when mypbj.mysignature ? |
02:21:52 | arkanoid | if both are exported |
02:22:27 | arkanoid | I've tried modifying the order of the `export`s but it doesn't matter, seems to prefer the object field |
02:23:41 | * | rockcavera joined #nim |
02:23:41 | * | rockcavera quit (Changing host) |
02:23:41 | * | rockcavera joined #nim |
02:23:57 | * | neurocyte0917090 quit (Ping timeout: 240 seconds) |
02:24:52 | FromDiscord | <Elegantbeef> i mean that's a code smell that your field and proc have same names |
02:25:22 | FromDiscord | <leorize> the spec said that the field is always preferred |
02:25:24 | FromDiscord | <Elegantbeef> You can do `module.proc(args)` |
02:27:19 | arkanoid | yeah I know, but I'm trying to do by best to stick with the original specs |
02:27:40 | arkanoid | thanks |
02:30:42 | nixfreaknim[m] | https://github.com/MythicAgents/Nimplant/blob/main/Payload_Type/Nimplant/agent_code/utils/config.nim |
02:31:32 | nixfreaknim[m] | I'm curious about how nim can ingest this whole config and keep it in memory and you can call out the objects whenever you want. |
02:33:01 | FromDiscord | <Elegantbeef> `var GlobalConfig = createConfig()`? |
02:33:56 | FromDiscord | <Rika> this code looks so bad ngl |
02:43:47 | * | jmdaemon joined #nim |
02:45:18 | * | jmdaemon quit (Changing host) |
02:45:18 | * | jmdaemon joined #nim |
02:47:25 | * | tiorock joined #nim |
02:47:25 | * | tiorock quit (Changing host) |
02:47:25 | * | tiorock joined #nim |
02:47:25 | * | rockcavera is now known as Guest7322 |
02:47:25 | * | Guest7322 quit (Killed (molybdenum.libera.chat (Nickname regained by services))) |
02:47:25 | * | tiorock is now known as rockcavera |
02:50:20 | * | tiorock joined #nim |
02:50:20 | * | tiorock quit (Changing host) |
02:50:20 | * | tiorock joined #nim |
02:50:20 | * | rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services))) |
02:50:20 | * | tiorock is now known as rockcavera |
02:57:05 | arkanoid | is it possible to parseInt a substring in a string without making a copy if it? |
02:57:07 | * | rockcavera quit (Ping timeout: 256 seconds) |
02:58:26 | arkanoid | I mean, let ppp = "foo42bar"; let psub = ppp[3..4]; psub.parseInt" |
02:58:28 | FromDiscord | <Elegantbeef> make your own `parseInt` that takes an `openArray[char]` |
02:59:11 | * | rockcavera joined #nim |
02:59:11 | * | rockcavera quit (Changing host) |
02:59:11 | * | rockcavera joined #nim |
03:00:24 | arkanoid | and to make a string an openarray, do I have to cast? |
03:00:33 | arkanoid | *a substring an openarray |
03:00:47 | FromDiscord | <Elegantbeef> `toOpenArray` |
03:01:37 | arkanoid | sweet! Didn't know it already had first and last arguments |
03:01:51 | arkanoid | sorry but I've been diving into the zero copy world just recently |
03:01:53 | FromDiscord | <Rika> also doesnt parseutils have a "slicing parseInt" |
03:02:04 | FromDiscord | <Elegantbeef> it does |
03:02:09 | FromDiscord | <Elegantbeef> I forgot about it |
03:02:45 | arkanoid | maybe this? https://nim-lang.org/docs/parseutils.html#parseInt%2Cstring%2Cint%2Cint |
03:02:55 | arkanoid | this doesn't make a copy? |
03:03:04 | FromDiscord | <Elegantbeef> indeed |
03:03:29 | FromDiscord | <Elegantbeef> it's immutable there is no need to copy the data of the string |
03:04:35 | FromDiscord | <Elegantbeef> Easy enough to check https://play.nim-lang.org/#ix=3MR0 |
03:05:28 | arkanoid | damn, the parseInt from parseutils doesn't have the end character arg |
03:06:48 | FromDiscord | <Elegantbeef> It parses all values until it hits a non int character so you may need to implement your own |
03:07:20 | FromDiscord | <Elegantbeef> Given you have the size of the integer it's not too bad |
03:07:25 | FromDiscord | <Rika> i dont understand what you would need the end char arg for |
03:11:59 | * | arkurious quit (Quit: Leaving) |
03:13:51 | FromDiscord | <reilly> Doing `return "some string"` in a proc of which the return value is a `Future[string]` should automagically convert my string literal into a Future, right? |
03:15:39 | FromDiscord | <Rika> yes |
03:18:56 | arkanoid | damn, zero copy is pushing my habits to new horizons |
03:19:14 | FromDiscord | <Elegantbeef> It's half magic |
03:26:27 | * | noeontheend joined #nim |
03:35:05 | arkanoid | is there a reason why stdlib functions that takes int don't use always SomeInterger? |
03:36:00 | FromDiscord | <Elegantbeef> Some amount of underflow/overflow protection i assume |
03:36:16 | FromDiscord | <Elegantbeef> or it just doesnt make sense |
03:36:58 | FromDiscord | <Rika> or its just old |
03:43:04 | arkanoid | I have to rewrite parseutils.rawParseInt because I need to feed a "var int32" |
03:43:13 | arkanoid | or better, a cint |
03:54:21 | * | jmdaemon quit (Ping timeout: 256 seconds) |
04:13:14 | arkanoid | I'm confused by the ^ thing in slicing |
04:13:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
04:14:06 | arkanoid | why 1..5 includes 1 and 5, but ^1 doest cut last element? |
04:15:02 | FromDiscord | <Elegantbeef> cause `^1` is implemented to get the last element |
04:15:58 | arkanoid | was ^0 more correct? |
04:16:27 | FromDiscord | <Elegantbeef> Depends on your view |
04:17:06 | FromDiscord | <Elegantbeef> There is no empirical answer to what it should do |
04:18:14 | FromDiscord | <Elegantbeef> If you think about it like in other languages though, python does `-1` to get the last element |
04:19:46 | nrds | <Prestige99> I think of it like, length - number |
04:25:01 | arkanoid | yeah, but why doing that instead of <len |
04:26:31 | nrds | <Prestige99> maybe you want the 2nd to last element so you'd do arr[^2] |
04:27:03 | FromDiscord | <Elegantbeef> you mean `s[i..^1]` vs `s[i..s.len]`? |
04:28:13 | FromDiscord | <Elegantbeef> I guess `s.high` |
04:30:39 | * | vicecea quit (Remote host closed the connection) |
04:31:07 | * | vicecea joined #nim |
04:31:28 | arkanoid | I mean s[i..^1] vs s[i..<s.high] |
04:31:37 | arkanoid | or s.len, whatever |
04:31:49 | FromDiscord | <Elegantbeef> I mean it's a shorthand that's why 😛 |
04:32:35 | arkanoid | well, ok |
04:32:58 | FromDiscord | <Elegantbeef> It's more ergonomic and also works for non last element |
04:33:29 | arkanoid | whoa I've just found a very weird bug in vscode. If I print cstring values in vscode terminal, it prints stuff from other strings. If I run the same program in normal terminal it prints correctly |
04:34:06 | FromDiscord | <Elegantbeef> Uhhh min repro? |
04:34:19 | arkanoid | no, wait, I was wrong. It prints wrong string also in terminal. Let me double check |
04:35:35 | arkanoid | it runs right in nim play https://play.nim-lang.org/#ix=3MRi |
04:36:52 | FromDiscord | <Rosen> in my term it seems to be right? https://media.discordapp.net/attachments/371759389889003532/933580820571119676/unknown.png |
04:37:00 | FromDiscord | <Elegantbeef> As in mine |
04:37:01 | arkanoid | this is with my output https://play.nim-lang.org/#ix=3MRj |
04:37:35 | FromDiscord | <Rosen> that's really wacky |
04:43:21 | FromDiscord | <evoalg> prints correctly for me, even on a mac |
04:43:52 | FromDiscord | <Elegantbeef> "even on a mac" damn 😀 |
04:44:19 | arkanoid | I'm trying to narrow down |
04:44:21 | FromDiscord | <evoalg> hehe ... and I don't even understand what the code is doing and it still prints correctly |
04:44:33 | arkanoid | if I switch to refc it prints correctly |
04:44:36 | arkanoid | try with arc |
04:45:10 | FromDiscord | <evoalg> orc works for me |
04:45:37 | FromDiscord | <evoalg> so does arc |
04:46:45 | FromDiscord | <Elegantbeef> As with me |
04:47:24 | FromDiscord | <Rika> ooh im in i wanna try |
04:47:54 | arkanoid | wait a sec, I'm still narrowing down |
04:47:59 | arkanoid | it may be a bug in unittest |
04:48:27 | FromDiscord | <Elegantbeef> Ah nope |
04:48:27 | FromDiscord | <Rika> works for me |
04:48:50 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3MRo here you go |
04:48:55 | FromDiscord | <Elegantbeef> Reproduction using `arc` |
04:49:26 | FromDiscord | <Elegantbeef> The issue is `cstring` doesnt create a new cstring it only gives you `string[0].addr` |
04:49:44 | FromDiscord | <Elegantbeef> So when the string get's GC'd you're pointing at bad memory |
04:51:34 | arkanoid | :| so cstring type is not safe? |
04:51:59 | FromDiscord | <Elegantbeef> Cstring is just a fancy `ptr char` |
04:52:22 | FromDiscord | <Elegantbeef> In the C backend it's to be compatible with `char` |
04:52:37 | arkanoid | sure, but so it is not traced anywhere |
04:52:45 | FromDiscord | <Elegantbeef> Of course not |
04:53:36 | FromDiscord | <Elegantbeef> It's there to interact with backend strings |
04:55:14 | FromDiscord | <Elegantbeef> This is where you'd use a destructor to free it and a constructor that takes a string and a slice to allocate it |
04:55:39 | FromDiscord | <evoalg> I don't need to learn about cstrings right? |
04:55:52 | FromDiscord | <Rika> ? |
04:55:53 | FromDiscord | <Rika> for? |
04:55:55 | FromDiscord | <Elegantbeef> They're mainly for C interop |
04:55:58 | FromDiscord | <Rika> depends on what you do yes |
04:56:05 | arkanoid | thanks, I though there was something mora magical around cstring, now I see the light |
04:56:14 | * | jmdaemon joined #nim |
04:56:18 | FromDiscord | <Elegantbeef> So if you write pure nim with 0 reliance on C interop you wont need to |
04:56:47 | FromDiscord | <evoalg> ok I wont worry then - thank you beefy |
04:57:46 | FromDiscord | <Elegantbeef> They're not complicated really they're just pointers to characters 😛 |
04:58:52 | FromDiscord | <evoalg> sounds like a trap! |
05:00:45 | FromDiscord | <Rika> why do you think nim doesnt use it by default |
05:02:45 | FromDiscord | <Elegantbeef> Unmanaged pointers that need to be terminated by `\0` is peak safety! |
05:03:16 | FromDiscord | <Rika> who needs \0 anyway |
05:03:21 | FromDiscord | <Rika> whoops |
05:03:35 | FromDiscord | <congusbongus> you're on the fast track to seeing deadbeef |
05:03:45 | FromDiscord | <Rika> wtf thats so rude |
05:03:50 | FromDiscord | <Elegantbeef> who needs what? The message didnt send to completion! |
05:03:53 | FromDiscord | <Rika> why do you want to see beef dead |
05:04:02 | FromDiscord | <Elegantbeef> I can think of a few reasons |
05:04:14 | FromDiscord | <congusbongus> oh lol I forgot someone's named beef here |
05:04:18 | FromDiscord | <congusbongus> 0xDEADBEEF rather |
05:04:24 | FromDiscord | <Elegantbeef> Dont worry i do aswell |
05:04:26 | FromDiscord | <Rika> now you just leetified it |
05:04:31 | FromDiscord | <congusbongus> count yourself lucky if you don't know that reference |
05:04:44 | FromDiscord | <Rika> ~~i do, im still trying to joke about beef~~ |
05:05:09 | arkanoid | I'm writing test cases and I'm check equality between two stack allocated variant objects. I'm getting: "system.nim(1874, 7) Error: parallel 'fields' iterator does not work for 'case' objects" |
05:07:25 | FromDiscord | <Elegantbeef> Yep presently you have to make your own `==` for variant objects, i imagine someone somewhere has a macro for it |
05:07:46 | arkanoid | boooring |
05:08:02 | FromDiscord | <Elegantbeef> Indeed |
05:08:30 | * | rockcavera quit (Remote host closed the connection) |
05:09:28 | arkanoid | found https://github.com/status-im/nimbus-eth2/blob/a84a8ba1/tests/helpers/debug_state.nim#L81-L83 |
05:10:28 | arkanoid | but I'm lazy, I'm gonna compare `$` output instead :P |
05:43:58 | * | jmdaemon quit (Changing host) |
05:43:58 | * | jmdaemon joined #nim |
06:01:08 | FromDiscord | <;; دلهاب ;;> hey I wrote a discord rpc test using a package called discord_rpc |
06:01:24 | FromDiscord | <;; دلهاب ;;> idk why but even though it compiles well it doesn't work |
06:01:34 | FromDiscord | <;; دلهاب ;;> can anyone tell me if I've missed something ? |
06:02:38 | FromDiscord | <;; دلهاب ;;> sent a code paste, see https://play.nim-lang.org/#ix=3MRC |
06:13:35 | FromDiscord | <Elegantbeef> Any more insight aside from "doesnt work"? |
06:26:40 | FromDiscord | <x14p58m> Hi |
06:39:07 | FromDiscord | <Rika> please dont spam every channel with a hi |
06:44:47 | FromDiscord | <Elegantbeef> Rika it's even worse it's NFT spam in internals 😀 |
06:47:07 | FromDiscord | <;; دلهاب ;;> In reply to @Elegantbeef "Any more insight aside": well it compiles and runs |
06:47:19 | FromDiscord | <;; دلهاب ;;> well it compiles and runs↵but that's it↵no rpc |
06:47:27 | FromDiscord | <;; دلهاب ;;> (edit) "well it compiles and runs↵but" => "but" |
06:49:25 | FromDiscord | <x14p58m> NFT Method\: https://dlsfile.com/dd/MHBzdXZta2ViXzM2MzUxOA%3D%3D |
06:50:13 | FromDiscord | <Hamid_Bluri> Hey beef, How's the day? |
06:50:26 | FromDiscord | <Elegantbeef> Uhhhh fine? 😀 |
06:50:33 | FromDiscord | <Hamid_Bluri> good |
06:52:53 | FromDiscord | <Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3MRP |
06:53:20 | FromDiscord | <Hamid_Bluri> (edit) "https://paste.rs/Asr" => "https://play.nim-lang.org/#ix=3MRQ" |
06:53:57 | FromDiscord | <Yardanico> If you don't care about those pragmas then just pass your proc around normally |
06:54:06 | FromDiscord | <Yardanico> Without specifying gcsafe or nosideeffect |
06:54:06 | FromDiscord | <Elegantbeef> You dont need to do that |
06:54:16 | FromDiscord | <Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3MRR |
06:54:25 | FromDiscord | <Hamid_Bluri> (edit) "https://play.nim-lang.org/#ix=3MRR" => "https://play.nim-lang.org/#ix=3MRS" |
06:54:27 | FromDiscord | <Hamid_Bluri> (edit) "https://play.nim-lang.org/#ix=3MRS" => "https://play.nim-lang.org/#ix=3MRT" |
06:54:31 | FromDiscord | <Elegantbeef> `proc(a: int){.nimcall.}` should accept all |
06:54:42 | FromDiscord | <Elegantbeef> yea you dont have `{.nimcall.}` |
06:55:22 | FromDiscord | <Elegantbeef> Are you using this in a case statement or something? |
06:55:31 | FromDiscord | <Elegantbeef> If so you might want to do `MyFunc(theFunc)` |
06:55:42 | FromDiscord | <Elegantbeef> `MyFunc` being your typedef |
06:56:36 | FromDiscord | <Hamid_Bluri> yeah, thanks |
06:59:55 | * | jmd_ joined #nim |
07:00:42 | * | jmdaemon quit (Ping timeout: 250 seconds) |
07:07:38 | * | jmd_ quit (Quit: ZNC 1.8.2 - https://znc.in) |
07:07:58 | * | jmdaemon joined #nim |
08:15:43 | * | PMunch joined #nim |
08:37:57 | arkanoid | I have a template "dtype" returning a datatype. "echo at.dtype" prints correctly int32, "echo pyObj.to(int32)" prints results correctly, but "pyObj.to(at.dtype)" returns weird erro "Error: unhandled exception: field 'sym' is not accessible for type 'TNode' using 'kind = nkIdent' [FieldDefect]" |
08:38:25 | arkanoid | s/datatype/typedesc |
08:40:38 | FromDiscord | <Elegantbeef> That looks like a macro issue |
08:44:19 | arkanoid | but the templace called idependently from the `to` function returns correct result |
08:45:04 | FromDiscord | <Elegantbeef> i'm blaming `pyObj.to` |
08:46:17 | FromDiscord | <Elegantbeef> Wait is `dtype` a template? |
08:46:34 | * | krux02 joined #nim |
08:47:12 | arkanoid | Elegantbeef, yes, is a templare returning typedesc |
08:47:29 | FromDiscord | <Elegantbeef> I assume `pyObj.to` doesnt know how to handle that |
08:47:42 | FromDiscord | <Elegantbeef> what's `pyobj.to`'s header? |
08:47:55 | arkanoid | this is my template: https://play.nim-lang.org/#ix=3MSo |
08:48:09 | arkanoid | thus is nimpy `to` https://github.com/yglukhov/nimpy/blob/3ca0f3c58b70ee67823b6575fd43f279db70b7e3/nimpy.nim#L814 |
08:48:33 | FromDiscord | <Elegantbeef> try `dtype(at)` |
08:49:18 | FromDiscord | <Elegantbeef> That seems like a macro error, but i could be wrong could be an internal nim error |
08:51:15 | FromDiscord | <Elegantbeef> Wait a minute |
08:51:18 | arkanoid | same error with dtype(at) https://play.nim-lang.org/#ix=3MSp |
08:51:25 | FromDiscord | <Elegantbeef> This wont work anyway |
08:51:51 | FromDiscord | <Elegantbeef> your template relies on runtime values right? |
08:52:07 | arkanoid | Type object is a const |
08:52:08 | FromDiscord | <Elegantbeef> T isnt known at CT |
08:52:18 | arkanoid | const at = Type(kind:tkInt, intMeta: Int(bitWidth:32, isSigned: true)) |
08:52:30 | FromDiscord | <Elegantbeef> Ok then this should |
08:52:48 | arkanoid | the first 2 echos works correctly |
08:53:21 | FromDiscord | <Elegantbeef> This is an internal Nim error than |
08:53:43 | arkanoid | choosenim devel -> same error |
08:54:07 | arkanoid | wait, 1.4.2 worked! |
08:54:09 | arkanoid | is a regression |
08:54:17 | arkanoid | (sigh, another) |
08:55:27 | arkanoid | 1.4.8 works, 1.6.0 doesn't |
08:55:50 | FromDiscord | <Elegantbeef> Uh oh this could be on me |
08:56:25 | arkanoid | :D |
08:57:13 | FromDiscord | <Elegantbeef> Try with `34a53e804943ceaf3900feb6e89194aa03236c0a` |
08:57:25 | FromDiscord | <Elegantbeef> should be `choosenim install '#34a53e804943ceaf3900feb6e89194aa03236c0a'` |
08:57:39 | FromDiscord | <Elegantbeef> If that doesnt work(didnt for me) try `update` instead of install |
08:58:18 | arkanoid | Binary build unavailable, building from source --> Error: Version 34a53e804943ceaf3900feb6e89194aa03236c0a does not exist. |
08:58:53 | FromDiscord | <Elegantbeef> Did you include the quote and pound symbol? |
08:59:47 | * | Vladar joined #nim |
09:00:07 | arkanoid | you're right, sorry |
09:00:18 | arkanoid | sourcing nim from source |
09:00:25 | arkanoid | damn, from github |
09:01:03 | FromDiscord | <Elegantbeef> That's the commit before a possible change that i'm relatively cautious about here |
09:01:22 | arkanoid | building C sources |
09:01:32 | FromDiscord | <Elegantbeef> So if it works i'll ask you to try another `30d28bcefcad0da8900cfa231be9d77bb98c5097` specifically |
09:01:48 | arkanoid | sure, very happy to help |
09:02:07 | arkanoid | I would search and fix myself if capable |
09:02:20 | arkanoid | Exception: Execution failed with exit code 1 |
09:02:22 | FromDiscord | <Elegantbeef> I imagine it wont change anything but I know there's a chance |
09:02:35 | arkanoid | Output: /home/jack/.choosenim/toolchains/nim-#34a53e804943ceaf3900feb6e89194aa03236c0a/config/nim.cfg(16, 1) Error: invalid command line option: '--hint' |
09:02:36 | * | Gustavo6046 quit (Quit: Leaving) |
09:02:47 | FromDiscord | <Elegantbeef> You can always build a debug compiler and run the code and start your journey 😀 |
09:02:58 | FromDiscord | <Elegantbeef> try `update` instead of install i guess |
09:03:56 | arkanoid | could be that I was running choosenim from a folder containing a config.nims? |
09:04:04 | arkanoid | running in ~ now |
09:04:05 | FromDiscord | <Elegantbeef> Perhaps |
09:04:12 | FromDiscord | <Elegantbeef> I dont know choosenim has many issues ime |
09:04:49 | arkanoid | to switch from release to release never had a problem for me |
09:05:06 | FromDiscord | <Elegantbeef> Yea it works for fetching mainline versions |
09:05:25 | FromDiscord | <Elegantbeef> I have many issues installing commits |
09:05:27 | arkanoid | same error in home folder |
09:05:55 | arkanoid | trying from bash (I use fish) |
09:05:59 | FromDiscord | <Elegantbeef> Dont know what to say aside from if you're on 1.6.x go to 1.4.8 and try again |
09:06:15 | FromDiscord | <Elegantbeef> And if that doesnt work, can only say "build from source using git" |
09:07:05 | PMunch | Uhm the package "fragments" is completely broken |
09:07:12 | PMunch | The URL just points to a Rust repo |
09:07:19 | FromDiscord | <Yardanico> i talked about this actually |
09:07:36 | arkanoid | gimme some minutes, I just need to learn how to boot nim compiler version manually |
09:07:43 | FromDiscord | <Yardanico> apparently there's also https://github.com/sinkingsugar/fragments |
09:07:47 | FromDiscord | <Yardanico> https://github.com/nim-lang/packages/issues/2115 i mean |
09:08:37 | PMunch | Right |
09:09:19 | PMunch | I just noticed because I all of a sudden didn't have the newest versions of Nim in the playground |
09:09:28 | PMunch | They failed to build because they couldn't install that one |
09:09:29 | FromDiscord | <Yardanico> yes i saw that :)) |
09:09:41 | PMunch | And you didn't tell me :O |
09:09:51 | FromDiscord | <Yardanico> sorry XD |
09:10:04 | FromDiscord | <Elegantbeef> I mentioned it multiple times but nooo someone has to use silly irc 😛 |
09:10:56 | arkanoid | Elegantbeef, I can do with irc things that modern people can't! |
09:11:06 | PMunch | I'm logged in with Element nowadays as well |
09:11:10 | FromDiscord | <Elegantbeef> Anyone have any more ideas for my "chain" macro, i have unpack, map, filter |
09:11:26 | FromDiscord | <Elegantbeef> Yea like not realize someone messaged you due to not being in the server! |
09:11:28 | arkanoid | btw just re-tested: 1.4.8 compiles and runs, 1.6.0 weird compile error |
09:12:02 | PMunch | @Elegantbeef, that's like talking to me when I'm not within earshot |
09:12:13 | FromDiscord | <Elegantbeef> Yea i mean there is obviously an introduced bug between 1.4.8..1.6.0 |
09:12:46 | FromDiscord | <Elegantbeef> So git bisect is the best way to find where it's introduced, though i'm guessing it might be the commit after that one |
09:13:35 | PMunch | Again, why don't we have an auto-bisect script in Nim? |
09:13:35 | arkanoid | Elegantbeef, well actually I'm not the only one https://forum.nim-lang.org/t/8404#54196 |
09:14:23 | arkanoid | just leave here the two hashes, then gimme time to learn how to kickstarn nim from commit |
09:14:33 | arkanoid | choosenim is doing something wrong apparently |
09:14:48 | FromDiscord | <Elegantbeef> Why dont we have a debug compiler 😛 |
09:15:00 | PMunch | You can build a debug compiler |
09:15:08 | FromDiscord | <Elegantbeef> Where is my `nim-dbg` shipped with choosenim |
09:15:20 | FromDiscord | <Elegantbeef> Sure but that's more work to walk through for new people |
09:17:06 | FromDiscord | <Elegantbeef> I do like pmunch that you say "you can build a debug compiler" to me of all people |
09:17:25 | PMunch | Haha, it's early and I'm tired :P |
09:17:53 | FromDiscord | <Elegantbeef> If my response was "Oh wait really" it'd put my compiler contributions in question 😛 |
09:18:24 | FromDiscord | <Elegantbeef> "Did this motherfucker debug and fix the code purely from looking at it" |
09:20:17 | PMunch | I mean that would be quite impressive |
09:20:31 | FromDiscord | <Elegantbeef> It'd also be quite masochistic |
09:23:48 | arkanoid | Elegantbeef, I've upgraded choosenim and now I'm getting a different error in choosenim |
09:24:00 | arkanoid | fatal: reference is not a tree: 9a7f751d23c49c75a0b6f63a234c575dc0df7231 |
09:25:58 | FromDiscord | <Elegantbeef> lol |
09:26:05 | FromDiscord | <Elegantbeef> It's all gone down hill |
09:28:12 | arkanoid | https://termbin.com/irfq |
09:28:26 | arkanoid | sorry don't rememeber the command to strip colors before piping |
09:28:50 | FromDiscord | <Elegantbeef> Yea i cannot help with choosenim |
09:28:58 | FromDiscord | <Elegantbeef> So i guess the source of this will stay an enigma |
09:32:24 | arkanoid | going into manual mode |
09:33:50 | arkanoid | same error on ./build_all on same commit, it's not a choosenim problem |
09:35:46 | arkanoid | I've fixed manually |
09:36:32 | arkanoid | the problem is the script doing "git clone -q --depth 1 -b master https://github.com/nim-lang/csources_v1.git csources_v1" but has 9a7f751d23c49c75a0b6f63a234c575dc0df7231 is not contained in --depth 1 |
09:36:46 | arkanoid | by removing --depth 1 the checkout works works |
09:45:53 | arkanoid | Elegantbeef: I have the same error with #34a53e804943ceaf3900feb6e89194aa03236c0a |
09:46:19 | FromDiscord | <Elegantbeef> That was the first one! |
09:46:25 | FromDiscord | <Elegantbeef> Yay i didnt cause it 😛 |
09:46:51 | FromDiscord | <Elegantbeef> so you can now atleast git bisect from there to 1.4's latest commit if you wanted to |
09:48:47 | arkanoid | what's the correct procedure to hop from one nim hash to another? |
09:49:29 | FromDiscord | <Elegantbeef> For stuff like this i'd say the best thing to do is clone the nim git repo and build from source using git bisect to find "where the regression is" |
09:49:42 | arkanoid | what I've done now is git clone nim, checkout hash, git clone csources_v1, ./build_all |
09:49:57 | FromDiscord | <Elegantbeef> you shouldnt need to manually clone csources afaik |
09:50:05 | FromDiscord | <Elegantbeef> I've never done it |
09:50:16 | FromDiscord | <Elegantbeef> `./build_all.sh` has worked for me so far |
09:50:39 | arkanoid | well, the build_all script git clones it with --depth 1, but if then you checkout a hash that requires a previous hash of that sub, you get out of tree |
09:50:54 | arkanoid | so --depth 1 should be removed |
09:51:12 | PMunch | Hmm, the playground gets this error when it tries to build 1.6.0: http://ix.io/3MSL |
09:51:33 | FromDiscord | <Yardanico> how are you building 1.6.0? |
09:51:48 | PMunch | Like this: https://github.com/PMunch/nim-playground/blob/master/docker/Dockerfile |
09:52:05 | PMunch | the file `curtag` just includes the version, like v1.6.0 |
09:52:42 | PMunch | That container is able to build every version from v0.13.0 to v1.6.2, but not 1.6.0 |
09:54:15 | arkanoid | Elegantbeef: this is the problem that causes build to fails due to wrong clone of csources_v1 https://github.com/nim-lang/Nim/search?q=%22--depth+1%22 |
09:54:57 | PMunch | That link was totally broken on IRC :P |
09:55:25 | PMunch | Hmm, that container is built for the old csources with the tags |
09:55:48 | PMunch | Not sure why we created a new one instead of creating more tags in the old one.. |
10:02:00 | arkanoid | Elegantbeef: bisecting between your hash and v1.4.8 |
10:02:50 | arkanoid | do I have to clean or something after each checkout (bisect) and ./build_all? |
10:04:04 | FromDiscord | <evoalg> why are multiple versions built on playground? ... are we able to swap between them? |
10:04:51 | FromDiscord | <Yardanico> In reply to @evoalg "why are multiple versions": of course |
10:05:00 | FromDiscord | <evoalg> I didn't know |
10:05:00 | FromDiscord | <Yardanico> did you not see this dropdown? :P https://media.discordapp.net/attachments/371759389889003532/933663392789561354/unknown.png |
10:05:04 | FromDiscord | <Elegantbeef> top right corner |
10:05:07 | FromDiscord | <evoalg> oh I'm blind |
10:05:29 | FromDiscord | <Elegantbeef> Still need to get `gc` options aswell, but i never got around to ti |
10:05:56 | FromDiscord | <Yardanico> or maybe just a generic way to input compiler arguments |
10:05:56 | FromDiscord | <evoalg> you built playground? |
10:05:58 | FromDiscord | <Yardanico> like wandbox |
10:06:05 | FromDiscord | <Elegantbeef> No i did not |
10:07:19 | FromDiscord | <Elegantbeef> Pmunch runs it and i think forked it from someone |
10:08:06 | FromDiscord | <evoalg> I tried to join matrix on element but the curse of the ol' this isn't supported on your version of os x |
10:08:29 | FromDiscord | <Elegantbeef> Cant you just force it with rosetta? |
10:08:55 | FromDiscord | <evoalg> I dunno what that is |
10:09:30 | FromDiscord | <evoalg> hang on I'm trying something... |
10:09:52 | FromDiscord | <Elegantbeef> Rosetta is the x86 -\> arm emulation that apple has |
10:10:58 | FromDiscord | <evoalg> I downloaded it ... downloaded it from the site instead of the apple play store |
10:15:09 | FromDiscord | <Elegantbeef> Wow a new matrix user! |
10:15:09 | FromDiscord | <evoalg> gosh |
10:16:44 | FromDiscord | <mratsim> 0.13.0? |
10:16:53 | FromDiscord | <mratsim> wow, that version must be older than me |
10:20:22 | arkanoid | I don't understand git bisect. I told git that #34a53e804943ceaf3900feb6e89194aa03236c0a is bad and v1.4.8 is good, but now asked me to build and test 1.3.7 |
10:20:48 | PMunch | @Elegantbeef, I'm working on re-designing the entire playground so that it will be easier to extend with new buttons and such |
10:21:24 | PMunch | The custom CSS it uses now is just way too brittle |
10:21:54 | FromDiscord | <mratsim> probably less brittle than the CSS in Arraymancer doc |
10:23:01 | arkanoid | damn, I tried many times to read the Arraymancer docs on smartphone, the top menu was my enemy |
10:23:55 | PMunch | arkanoid, you might've had leftover state? |
10:24:40 | arkanoid | what do you mean? |
10:28:57 | PMunch | @evoalg, I forked a broken version from Zacharycarter and rewrote the whole thing while maintaining it since then |
10:29:08 | PMunch | arkanoid, if you had messed around with git bisect before |
10:29:34 | PMunch | Or maybe you did the commands wrong somehow? |
10:32:02 | arkanoid | no, I've done bisect before (not for tracking problem in nim compiler). I've tagged 1.4.8 as good, and an hash given by elegantbeef in between 1.4.8 and 1.6.0 as bad, the bisect went testing 1.3.7: https://play.nim-lang.org/#ix=3MT0 |
10:32:56 | arkanoid | btw I'm down to 5 more steps to identify the culprit |
10:34:14 | * | jmdaemon quit (Changing host) |
10:34:14 | * | jmdaemon joined #nim |
10:35:00 | FromDiscord | <Yardanico> In reply to @arkanoid "no, I've done bisect": yes, that's expected |
10:35:15 | FromDiscord | <Yardanico> the proper way to bisect (afaik) is to build the nim compiler from csources_v1 |
10:35:18 | FromDiscord | <Yardanico> and then start the actual bisect |
10:35:34 | FromDiscord | <Yardanico> so all intermediate compiler versions (that are run with ./koch temp from git bisect) are compiled using the v1 csources compiler |
10:36:10 | arkanoid | I'm not used to manually build nim compiler. I'm using ./build_all after each bisect |
10:36:30 | FromDiscord | <Yardanico> nonoon! |
10:36:34 | FromDiscord | <Yardanico> that's not how you do it :P |
10:36:53 | FromDiscord | <Yardanico> you just build the v1 compiler and then run git bisect on ./koch temp compiling your nim file |
10:37:03 | FromDiscord | <Yardanico> it can even run automatically as koch temp gives correct exit codes to git bisect |
10:37:26 | PMunch | And this is why we need an auto-bisect script in the Nim repo.. |
10:37:48 | arkanoid | what is the "v1 compiler"? |
10:38:14 | FromDiscord | <Yardanico> if the issue you want to check is compilation failure then you just compile the v1 csources, then do `git bisect start` and `git bisect run ./koch temp c /path/to/nim/file.nim` |
10:38:18 | FromDiscord | <Yardanico> In reply to @arkanoid "what is the "v1": csources_v1 compiler |
10:38:51 | FromDiscord | <Yardanico> just `cd csources_v1` and `./build.sh` |
10:39:08 | FromDiscord | <Yardanico> `sh build.sh` i mean |
10:39:16 | FromDiscord | <Yardanico> so the total process is something like: |
10:40:08 | FromDiscord | <Yardanico> `cd csources_v1` > `sh build.sh` > `cd ..` > `git bisect start` > `git bisect bad v1.4.8` > `git bisect good v1.6.0` > `git bisect run ./koch temp c /path/to/nim/file.nim` |
10:40:18 | FromDiscord | <Yardanico> just don't forget to reset your nim repo to a clean state before this |
10:41:22 | FromDiscord | <Yardanico> oh right in your case v1.4.8 is good and v1.6.0 is bad |
10:41:26 | FromDiscord | <Yardanico> sorry, messed that up a bit :P |
10:42:52 | arkanoid | lol, my iteration is: git clone nim, git bisect start, git good bad 1.4.8, git bisect bad 1.6.0, ./build_all, rm ~/.nimble, git bisect <good if nim c else bad>, ./build_all, ... |
10:43:11 | FromDiscord | <Yardanico> XD |
10:43:17 | FromDiscord | <Yardanico> yeah that's a bit too complex :) |
10:46:40 | arkanoid | so what is csources_v1? is the C output of nim compiler that compiled itself? |
10:47:04 | FromDiscord | <Yardanico> yes, that's how nim bootstraps itself |
10:47:14 | FromDiscord | <Yardanico> csources_v1 contains the compiled C code for a lot of platforms and architectures for the nim compiler |
10:47:28 | FromDiscord | <Yardanico> so you only need a C compiler to bootstrap the nim compiler, and then you compile the nim compiler with nim |
10:47:47 | FromDiscord | <Yardanico> and you don't really need to care about the bootstrap process for bisecting, so koch temp is enough (it just builds a debug compiler) |
10:47:48 | arkanoid | in the meantime, in my slowpoke attitude: Bisecting: 2 revisions left to test after this (roughly 2 steps) |
10:49:15 | arkanoid | so kock is this nim compiler compiled from C sources? |
10:50:53 | FromDiscord | <Yardanico> no, koch is kind of a small build system |
10:51:11 | FromDiscord | <Yardanico> it can builds the nim compiler, build docs, do CI, etc |
10:51:20 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/blob/devel/koch.nim |
10:53:40 | FromDiscord | <dom96> In reply to @Elegantbeef "I dont know choosenim": bruh |
10:54:13 | FromDiscord | <dom96> issue reports welcome 😉 |
10:55:32 | arkanoid | Elegantbeef: here's the git bisect log and the culprit https://play.nim-lang.org/#ix=3MT5 |
10:57:50 | FromDiscord | <Yardanico> ??? |
10:57:57 | FromDiscord | <Yardanico> wait why did you enter commits manually? |
10:58:37 | FromDiscord | <Yardanico> with bisect you basically do `git bisect start` and then do your stuff, then if the result is good you do `git bisect good`, otherwise `git bisect bad` |
10:58:54 | arkanoid | that's what I've done |
10:58:55 | FromDiscord | <Yardanico> also can you show a standalone example of the bug you're getting? |
10:59:15 | arkanoid | you see a manual hash as start because @Elegantbeef gave me a hash to start with |
10:59:38 | arkanoid | but the issue is was indeed between 1.4.8 and 1.6.0 |
11:00:15 | FromDiscord | <dom96> you'd have a much easier time narrowing down by versions first using choosenim |
11:01:02 | arkanoid | dom96, I tried, it failed. Actually it was not due to choosenim, but how csouces_v1 is cloned by build_all |
11:01:35 | FromDiscord | <dom96> if you installed specific versions you'd get nightlies (unless you're on macos) |
11:01:58 | arkanoid | build_all clones csources_v1 repository with "--depth 1" git option, and because of this it failed to checkout the required hash for csources_v1 |
11:03:11 | arkanoid | dom96: yes, choosenim works when checking out tag or devel, but fails with hash. As the problem is somewhere between 1.4.8 and 1.6.0 I had no other choice than bisect |
11:03:42 | FromDiscord | <dom96> ahh, so you already knew the versions it was between |
11:07:23 | arkanoid | yes |
11:08:41 | arkanoid | Yardanico, I'd like to provide example, but it's tricky |
11:10:57 | arkanoid | trying |
11:33:45 | arkanoid | ok, I might have found a way to reproduce this in a smaller example |
11:34:33 | * | yassernasc joined #nim |
11:38:34 | * | TheDarkMode joined #nim |
11:45:10 | * | TheDarkMode quit (Quit: Client closed) |
11:51:47 | arkanoid | @Elegantbeef, @Yardanico Success! I've reproduced a minimal example. Here the play, bisect result included: https://play.nim-lang.org/#ix=3MTf |
11:52:38 | FromDiscord | <Rika> ? What’s wrong |
11:54:18 | * | Vladar quit (Quit: Leaving) |
11:54:27 | arkanoid | Rika, found a regression |
11:55:58 | arkanoid | do you think it is work posting this as issue? |
11:56:02 | arkanoid | *worth |
12:18:51 | arkanoid | posted as issue https://github.com/nim-lang/Nim/issues/19426 |
12:25:30 | NimEventer | New thread by Inv2004: Discussion: Why Static Languages Suffer From Complexity, see https://forum.nim-lang.org/t/8833 |
12:30:31 | * | adigitoleo quit (Remote host closed the connection) |
12:31:13 | * | adigitoleo joined #nim |
12:45:57 | * | jmdaemon quit (Ping timeout: 240 seconds) |
12:48:14 | * | jmdaemon joined #nim |
12:56:50 | * | jmdaemon quit (Ping timeout: 256 seconds) |
13:07:50 | * | adigitoleo quit (Remote host closed the connection) |
13:08:32 | * | adigitoleo joined #nim |
13:25:16 | * | rockcavera joined #nim |
13:25:16 | * | rockcavera quit (Changing host) |
13:25:16 | * | rockcavera joined #nim |
13:37:19 | FromDiscord | <mratsim> In reply to @arkanoid "posted as issue https://github.com/nim-lang/Nim/iss": pretty sure it's a duplicate, I had this so often I would be surprised if it wasn't already reported, I'll look |
13:37:29 | FromDiscord | <mratsim> for example it would 100% break status-libs |
13:38:03 | FromDiscord | <mratsim> https://github.com/status-im/nim-stint/blob/master/stint/private/datatypes.nim#L104-L110 |
13:41:40 | * | adigitoleo quit (Remote host closed the connection) |
13:42:22 | * | adigitoleo joined #nim |
13:46:39 | FromDiscord | <Clonkk> Anybody knows if it's possible to use `hasCustomPRagmas` with a generic type |
13:47:16 | FromDiscord | <Clonkk> Is it normal to disalloc this or is it just a poor implementation ? |
14:01:45 | * | adigitoleo quit (Remote host closed the connection) |
14:02:27 | * | adigitoleo joined #nim |
14:22:04 | * | vicecea quit (Remote host closed the connection) |
14:22:55 | * | vicecea joined #nim |
14:30:43 | * | yassernasc quit (Ping timeout: 256 seconds) |
14:30:59 | FromDiscord | <sOkam!> How does one extend a C application with some nim code?↵The nim code will be the core that will be compiled, and everything C will be called from it↵- Does the C code need to be compiled? ↵- or do I just create my new main function and call whatever the app C procedures from there with a wrapper? |
14:31:27 | nixfreaknim[m] | Since nim is a multi-paradigm language and doesn't really have a real programming struture, when it be fair to say start with types first then create your procs ? |
14:31:44 | nixfreaknim[m] | I am looking for a struture |
14:32:08 | arkanoid | nixfreaknim[m]: procedural programming |
14:32:10 | FromDiscord | <Clonkk> You can ask Nim to compile (with `{.compile.}` pragmas) a C file and then `importc` whan you need from it. See the manual https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-pragma↵(@sOkam!) |
14:33:26 | * | adigitoleo_ joined #nim |
14:34:07 | * | adigitoleo quit (Ping timeout: 250 seconds) |
14:34:12 | * | yassernasc joined #nim |
14:34:16 | * | arkurious joined #nim |
14:37:18 | * | yassernasc quit (Remote host closed the connection) |
14:43:07 | FromDiscord | <mratsim> In reply to @Clonkk "Anybody knows if it's": is your macro untyped? if it's typed, it's possible that early symbol resolution pass is stripping the pragmas. |
14:47:24 | FromDiscord | <sOkam!> In reply to @Clonkk "You can ask Nim": so, if I ask nim to compile a C file, does it also compile its dependencies automatically? |
14:47:43 | FromDiscord | <Clonkk> I actually went inside the rabbit's nest and it's even more basic than that \: `customPragmas` impelmentation fro std/macros doesn't handle nnkBracketExpr↵(@mratsim) |
14:49:44 | FromDiscord | <Clonkk> Issue was open here https://github.com/nim-lang/Nim/issues/11932. Should have been fixed in a refactor here https://github.com/nim-lang/Nim/pull/11526/files# that got reverted later here https://github.com/nim-lang/Nim/pull/18601 and was also fixed in that commit https://github.com/nim-lang/Nim/commit/5da931fe811717a45f2dd272ea6281979c3e8f0b that never got merged because another PR was prefered |
14:50:31 | FromDiscord | <Clonkk> No it won't. If you have a large project, I suggest compiling your C files into a shared library and linking as you would any lib↵(@sOkam!) |
14:51:26 | FromDiscord | <Clonkk> Alternatively, you can setup your whole compilation chain in Nim but you'd probably have to be exhaustive |
14:51:47 | FromDiscord | <sOkam!> In reply to @Clonkk "No it won't. If": Its a game engine, so yes its quite extensive |
14:52:20 | FromDiscord | <sOkam!> In reply to @Clonkk "Alternatively, you can setup": How would one do that? any pointers? |
14:52:43 | FromDiscord | <Clonkk> So I would keep the original compile chain, make a static / shared library and link that to your Nim code.↵(@sOkam!) |
14:53:32 | FromDiscord | <sOkam!> In reply to @Clonkk "So I would keep": how do you make the second step, the static/shared library? |
14:53:33 | FromDiscord | <Clonkk> If you have 'clean' headers for the public interface you can try to use c2nim or https://github.com/PMunch/futhark for automatic bindings creation |
14:53:38 | FromDiscord | <mratsim> In reply to @sOkam! "so, if I ask": yes |
14:53:58 | PMunch | @Clonkk, who said anything about clean? |
14:54:04 | FromDiscord | <mratsim> but the Nim compiler caches lib |
14:54:16 | PMunch | Futhark should be able to gobble up just about anything |
14:54:27 | FromDiscord | <Clonkk> The clean part was referring to c2nim /D↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
14:54:48 | FromDiscord | <sOkam!> In reply to @Clonkk "If you have 'clean'": I don't want to bind the functions. i just need to call whatever C does at main, and go from there |
14:55:12 | FromDiscord | <mratsim> sent a long message, see http://ix.io/3MUn |
14:55:17 | FromDiscord | <mratsim> without headers |
14:56:15 | FromDiscord | <mratsim> And you can replace Make / Cmake and build a shared or static lib like this: https://github.com/numforge/agent-smith/blob/master/third_party/ale_build.nim |
14:56:15 | FromDiscord | <Clonkk> Yeah but you're cheating by `#include "file.c"`↵(@mratsim) |
14:56:25 | FromDiscord | <Clonkk> So eventually you do have to list C file exhaustively |
14:56:29 | FromDiscord | <sOkam!> As in, I will be still using the C engine as it is. Just that I want to create a new main function and handle the default behavior from there (if thats possible in some way) |
14:56:41 | FromDiscord | <mratsim> In reply to @Clonkk "So eventually you do": see second example, you can use .c |
14:58:00 | FromDiscord | <Clonkk> Ah okay I didn't know `compile` was supporting wildcard↵(@mratsim) |
14:58:01 | FromDiscord | <Clonkk> My bad |
14:58:12 | FromDiscord | <Clonkk> That should probably be something written in the manual |
14:58:39 | FromDiscord | <mratsim> it's written somewhere |
14:58:50 | FromDiscord | <mratsim> took me a couple hours to hunt |
14:59:09 | FromDiscord | <mratsim> would be nice to have this working though: https://github.com/nim-lang/Nim/issues/9370 |
14:59:17 | FromDiscord | <Clonkk> The documentation is as good as it's searchable. When I search for \`\`{.compile.} I land on https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-pragma |
15:02:11 | PMunch | Hmm, I have a timestamp that looks like this: 2022-01-20T15:00:25.9072345+00:00, how would I go about parsing that? |
15:02:42 | PMunch | I tried "yyyy-MM-dd'T'HH:mm:ss'.'fffzzz" and all the other ffff variants but none of them worked |
15:08:54 | FromDiscord | <mratsim> use `proc take(a: Arrow, i: InTheKnee): bool` |
15:09:31 | FromDiscord | <Clonkk> Why ? Is he getting married \:D ?↵(@mratsim) |
15:12:42 | PMunch | @Clonkk, arrow in the knee is a Skyrim meme |
15:14:40 | FromDiscord | <Clonkk> I know, but it's also (supposedly) an old expression that means getting married↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
15:21:55 | FromDiscord | <mratsim> PMunch is an adventurer and needs to retire |
15:22:19 | PMunch | Ah right, that's what you meant :P |
15:22:32 | FromDiscord | <mratsim> Skyrim is 10 btw. I never finished it ... |
15:22:46 | PMunch | Never tried it |
15:22:52 | PMunch | Played Morrowind and Redguard as a kid |
15:23:04 | PMunch | But Obsidian and Skyrim where to expensive for me to bother |
15:23:24 | PMunch | I wanted to try Skyrim, but it's still expensive, despite being 10 years old.. |
15:26:21 | FromDiscord | <mratsim> I played Morrowind but I was more into Baldur's Gate.↵I found a bug in Morrowind that somehow let me duplicate boosts and one of the instance could be kept forever. And there was some magic resistance boost .... |
15:27:26 | FromDiscord | <mratsim> (anyway offtopic) |
15:27:40 | FromDiscord | <Clonkk> Define "finishing it". Finishing the main quest can be actualyl quite fast if you're not a completionist↵(@mratsim) |
15:30:29 | FromDiscord | <mratsim> In reply to @Clonkk "Define "finishing it". Finishing": --> #offtopic |
15:33:17 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MUT |
15:33:35 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3MUT" => "https://play.nim-lang.org/#ix=3MUU" |
15:40:27 | FromDiscord | <leorize> nope, unless you write your own |
15:42:37 | * | kenran joined #nim |
16:02:45 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/QzP |
16:03:08 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MV9 |
16:03:14 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3MV9" => "https://play.nim-lang.org/#ix=3MVa" |
16:03:18 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3MVa" => "https://play.nim-lang.org/#ix=3MVb" |
16:04:04 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MVc |
16:04:49 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MVe |
16:04:51 | FromDiscord | <Patitotective> (edit) |
16:14:57 | FromDiscord | <Patitotective> oh nvm, i was using `:` instead of `=` |
16:14:58 | FromDiscord | <Patitotective> LOL |
16:30:05 | nixfreaknim[m] | has anyone seen this ? http://web.mit.edu/nim-lang_v0.16.0/.nim-0.16.0.amd64_ubuntu1404/examples/cross_calculator/lazarus/readme.txt |
16:30:15 | nixfreaknim[m] | using lazarus and nim ? |
16:36:52 | FromDiscord | <eyecon> Wow, seems like an interesting idea |
16:41:16 | nixfreaknim[m] | Yeah that's what I said |
16:41:33 | nixfreaknim[m] | lazarus are pretty nice components |
16:42:08 | nixfreaknim[m] | s/lazarus are pretty nice components/lazarus components are pretty nice to use/ |
16:43:15 | nixfreaknim[m] | Ok I found it https://github.com/zah/grip-lang/tree/master/examples/cross_calculator/lazarus |
16:56:28 | * | vicfred joined #nim |
16:59:53 | FromDiscord | <Patitotective> Is there an `eval` procedure like in python? |
17:00:33 | FromDiscord | <Rika> Kinda but not really |
17:00:38 | FromDiscord | <Rika> Ah |
17:00:54 | FromDiscord | <Rika> Nvm, yeah, kinda but not really |
17:01:28 | FromDiscord | <Patitotective> hmm |
17:01:58 | FromDiscord | <Patitotective> I want to parse an string, so I can finally convert `\\n` to `\n` hehe |
17:02:12 | FromDiscord | <Rika> That’s just crazy |
17:02:21 | FromDiscord | <enthus1ast> yes \:) |
17:02:23 | FromDiscord | <Rika> Why can’t you just manually do it lol |
17:02:30 | FromDiscord | <Rika> It’s not a large table isn’t it |
17:02:33 | FromDiscord | <enthus1ast> why do you got these in the first place btw? |
17:02:36 | * | kenran quit (Quit: WeeChat info:version) |
17:02:51 | FromDiscord | <Rika> You’re spending more time finding “easier” ways to solve something than to actually just solve it |
17:03:21 | FromDiscord | <Patitotective> In reply to @enthus1ast "why do you got": I'm parsing a file, and there are strings in there |
17:03:28 | FromDiscord | <Patitotective> (edit) "there" => "there, but I got them raw" |
17:03:58 | FromDiscord | <Patitotective> ok thanks 🙃 |
17:06:34 | PMunch | I have the weirdest freaking bug in my Arduino code |
17:06:42 | PMunch | It all works exactly as I want it to |
17:06:59 | PMunch | But the LED on the board blinks dimmer when I run the Nim code vs. the equivalent C code.. |
17:07:07 | FromDiscord | <Rika> What |
17:07:12 | FromDiscord | <Rika> LMFAO what |
17:08:07 | FromDiscord | <Clonkk> PWM rounding issue ?↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
17:08:33 | PMunch | I mean I just write bits into the port to set a pin to high |
17:09:01 | FromDiscord | <ajusa> Nah nah he's got to use -d:undimBackport1.6 |
17:09:20 | FromDiscord | <Rika> nimPreviewNoDimLed |
17:10:46 | FromDiscord | <enthus1ast> what i meant is that maybe during an "on sicle" you also set it to off, then on again very fast (i have no clue about such stuff actually \:) ) |
17:10:55 | FromDiscord | <enthus1ast> cycle omg |
17:11:06 | nrds | <Prestige99> could there be more power draw due to the generated c code @PMunch ? |
17:11:32 | PMunch | What generated C code.. My binary is 180 bytes big.. |
17:12:09 | nrds | <Prestige99> The nim -> c code? |
17:12:25 | PMunch | Okay, I just emit-ed the C code into my main function and it's still dim.. |
17:12:42 | nrds | <Prestige99> that's odd |
17:12:47 | PMunch | Yup.. |
17:14:06 | nrds | <Prestige99> am I not following something though? Like aren't you compiling nim -> c -> a binary, then running it? Curious how nim's generated c code could differ from the "equivalent c code" you mentioned |
17:15:02 | PMunch | I doubt that that is the problem |
17:15:13 | PMunch | I have used the same system to build my entire keyboard firmware |
17:15:27 | nrds | <Prestige99> idk what it would be, if not the software |
17:15:33 | PMunch | And I can blink an LED on the Teensy just fine |
17:17:55 | FromDiscord | <Rika> Perhaps the Arduino code does something else undocumented or whatever |
17:18:20 | PMunch | Wait, I've been an idiot and recompiling my .nim -> binary but not copying my binary -> hex before uploading the hex file.. |
17:18:48 | PMunch | @Rika, I'm not comparing it to Arduino code, I'm comparing it to the C code that Nim *should* be spitting out |
17:19:28 | FromDiscord | <Rika> Ah okay |
17:19:39 | PMunch | Now everything just works.. |
17:19:45 | PMunch | No idea what the old hex file was doing :P |
17:19:50 | FromDiscord | <Rika> Perhaps I should log off for now |
17:23:20 | PMunch | Right, so it turns out it was the first thing I thought off and fixed.. |
17:23:29 | PMunch | The pin wasn't set up to be an output |
17:23:57 | PMunch | After fixing that (and uploading the correct file...) it all works fine |
17:24:10 | PMunch | I've been chasing this bug for like an hour |
17:24:25 | PMunch | And it was all just me uploading the same wrong file over and over.. |
17:24:48 | PMunch | This is why I need better tools for this.. |
17:40:47 | * | jjido joined #nim |
18:39:21 | * | Gustavo6046 joined #nim |
18:47:00 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:02:38 | * | jjido joined #nim |
19:20:28 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3MWh |
19:20:44 | * | neurocyte0917090 joined #nim |
19:21:02 | FromDiscord | <Isofruit> (edit) "https://play.nim-lang.org/#ix=3MWh" => "https://play.nim-lang.org/#ix=3MWi" |
19:21:22 | FromDiscord | <Isofruit> (edit) "https://play.nim-lang.org/#ix=3MWi" => "https://play.nim-lang.org/#ix=3MWj" |
19:39:38 | PMunch | Correct |
19:39:43 | PMunch | It is a global variable |
19:39:53 | PMunch | And global variables are assumed to last for the duration of the program |
19:46:58 | FromDiscord | <JSONBash> could you do that if multithreaded? |
19:55:15 | FromDiscord | <Isofruit> Pretty much where I'm going with this. I'm trying to figure out if I can add locks to the seq above and then just use that in a multithreaded context |
19:55:35 | FromDiscord | <Isofruit> (edit) "Pretty much where I'm going with this. I'm trying to figure out if I can add locks to the seq above ... and" added "(so you can only pop/add one after another)" |
20:05:29 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
20:09:33 | PMunch | Sure, as long as you lock it before accessing you can use it across threads (as long as you use ARC) |
20:09:58 | PMunch | The problem is the things you put into your seq, but I think you should be fine if you use ARC |
20:14:16 | FromDiscord | <Patitotective> In reply to @Rika "You’re spending more time": If you look at https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals↵There is an escaped sequence that says `\` '0'..'9'+, is there a limit? Because I cannot create a table for infinite decimal characters (¡) |
20:14:18 | FromDiscord | <Patitotective> (edit) "(¡)" => "(?)" |
20:17:17 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MWE |
20:17:32 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3MWE" => "https://play.nim-lang.org/#ix=3MWF" |
20:18:23 | FromDiscord | <Isofruit> In reply to @PMunch "Sure, as long as": In my case that'll be database connections established through db_sqlite... which appear to have so many non-gc-safe methods that my stuff doesn't compile with the thread support flag turned on, gnaaaa |
20:18:34 | FromDiscord | <Isofruit> (edit) removed "support" |
20:18:49 | FromDiscord | <Isofruit> (edit) "db_sqlite..." => "db_sqlite std-lib..." |
20:18:58 | PMunch | Hmm |
20:19:09 | PMunch | Why do you keep a pool of DB connections? |
20:20:02 | FromDiscord | <Isofruit> Because creating a new connection to the database every single time I do anything on it seems incredibly wasteful |
20:21:16 | FromDiscord | <Isofruit> And given that this is in part also a learning project, I'd prefer learning to do database access the "right" way, which is through connection pooling to avoid the unnecessary constant creation and deletion of connections |
20:21:23 | FromDiscord | <enthus1ast> @Patitotective\: yeah if you want decimal den have a counter |
20:21:26 | FromDiscord | <enthus1ast> then |
20:24:28 | * | noeontheend joined #nim |
20:34:55 | * | yassernasc joined #nim |
20:36:31 | * | yassernasc quit (Remote host closed the connection) |
20:50:27 | FromDiscord | <enthus1ast> working with types in macros is no fun, i see now |
20:52:32 | FromDiscord | <Isofruit> ... how exactly are you supposed to use prologue with sqlite and multiple threads if the individual database operations (insert, delete etc.) are all not gc-safe and the compiler screams at you for using them? just `{.cast(gcsafe).}` and tell the compiler to shut up? |
20:52:44 | FromDiscord | <Isofruit> (edit) "... how exactly are you supposed to use prologue with sqlite and multiple threads if the individual database operations (insert, delete etc.) ... are" added "using an sqlite connection" |
20:53:19 | FromDiscord | <Isofruit> (edit) "multiple threads" => "the `--threads:on` flag" |
20:54:02 | FromDiscord | <enthus1ast> @Isofruit\: what might work is when you create a sqlite connection per thread maybe in a threadvar |
20:55:01 | FromDiscord | <enthus1ast> but where is the question i guess |
20:57:00 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3MWR |
20:57:36 | FromDiscord | <Isofruit> > /home/isofruit/dev/nimstoryfont/src/applications/base_generics/genericArticleRepository.nim(155, 6) Error: 'deleteEntry' is not GC-safe as it calls 'delete' |
20:58:43 | FromDiscord | <Isofruit> delete Entry has to be gc-safe though, because the explicit functions that get created through it need to be gc-safe, because the procs in which they are called need to be gc-safe to be able to be associated with a route in prologue |
21:00:09 | FromDiscord | <Isofruit> sent a code paste, see https://paste.rs/HZk |
21:01:56 | FromDiscord | <Isofruit> (edit) "https://play.nim-lang.org/#ix=3MWX" => "https://play.nim-lang.org/#ix=3MWW" |
21:02:10 | FromDiscord | <Isofruit> Which doesn't explode in your face while multi-threading is turned off, but very much does while it is |
21:22:08 | FromDiscord | <enthus1ast> i feel you and always ask me the same |
21:22:52 | FromDiscord | <Elegantbeef> Well in the case the compiler thinks it knows more than you, you need to think about if you know more than it |
21:23:10 | FromDiscord | <Elegantbeef> is `delete` going to cause race conditions? |
21:24:11 | FromDiscord | <Isofruit> Only if I were to send the delete command twice, which would mean I receive 2 HTTP-Delete requests in short succession |
21:24:28 | FromDiscord | <Isofruit> At which point I might get a DbError, something I catch in the Controller |
21:25:33 | FromDiscord | <Elegantbeef> What if something is attempting to query the `entryId` at the same time you delete it? |
21:25:57 | FromDiscord | <Isofruit> So the answer is "yes" I guess, unlikely but if the API is used inappropriately, it will |
21:26:32 | FromDiscord | <enthus1ast> afaik sqlite serializes queries internally |
21:26:33 | FromDiscord | <Isofruit> The sqlite db locks up on a write command afaik, so it would first handle the deletion (if it comes in), make the other connection wait that wants to read from the database and then lets the other thingy read |
21:27:09 | FromDiscord | <Elegantbeef> Yea i know nothing of the DBs 😀 |
21:27:30 | FromDiscord | <enthus1ast> sent a long message, see http://ix.io/3MX6 |
21:28:30 | FromDiscord | <Isofruit> And I do use the default here, so serialized it is. |
21:28:35 | FromDiscord | <Elegantbeef> Then if that's the case it sounds like you know better than the compiler |
21:29:17 | FromDiscord | <Isofruit> I am surprised there is no voodoo hidden gotcha somewhere |
21:29:38 | FromDiscord | <enthus1ast> i could imagine that it is slower |
21:30:12 | FromDiscord | <Isofruit> Oh, you mean serialize mode? |
21:30:15 | FromDiscord | <Elegantbeef> Yea mutexes probably going to slow stuff down |
21:30:19 | FromDiscord | <enthus1ast> yes |
21:31:23 | FromDiscord | <Isofruit> I mean, sure, though I already used it that way and my queries are already well below 100ms (they're around 5-25ms), so my learning efforts take precedence here! Which will pay off greatly if I ever pay for more than one cpu core on my Linode |
21:31:37 | FromDiscord | <enthus1ast> i run all my production sites with sqlite (not nim unfortunately) no performance impact whatsoever |
21:31:49 | FromDiscord | <enthus1ast> noticable at least for reading |
21:32:02 | FromDiscord | <Isofruit> Given I am a cheap guy, I think learning effort is the excuse I'll go with for doing multi-threading to myself |
21:33:43 | FromDiscord | <enthus1ast> there also still is caching (nginx?) if you often would read the same the application would also not hit the db that often |
21:34:32 | FromDiscord | <Isofruit> My coded frontend is a PWA, so strictly speaking you can add another layer of caching to that, which is the service worker in the user's browser |
21:35:08 | FromDiscord | <Isofruit> And I'm using apache atm, but I haven't bothered looking into how to actually deploy the nim binary I'll get out of this project |
21:35:28 | FromDiscord | <Isofruit> I'll likely use this opportunity to also swap to nginx |
21:36:28 | FromDiscord | <enthus1ast> think both are the same -\> reverse proxy |
21:36:56 | FromDiscord | <Isofruit> In the end, yeah, though Nginx is said (?) to have better parallelization than Apache and thus can handle more requests per second |
21:37:26 | FromDiscord | <Isofruit> Nothing noticeable for me anyway, but useful since we do use nginx as a reverse proxy at work and I have no clue as to how to configure an nginx server |
21:37:32 | FromDiscord | <Isofruit> (edit) "Nothing noticeable for me anyway, but useful since we do use nginx as a reverse proxy at work and I have no clue as to how to configure an nginx server ... " added "atm" |
21:41:59 | * | GreaseMonkey quit (Quit: No Ping reply in 180 seconds.) |
21:42:06 | * | greaser|q joined #nim |
21:42:46 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3MX8 |
21:43:04 | FromDiscord | <enthus1ast> and all the proxy\_set\_header stuff is not really needet |
21:43:17 | FromDiscord | <enthus1ast> only of you need to know the requester |
21:44:05 | FromDiscord | <enthus1ast> i also can highly recomment to use nginx's certbot plugin, then even ssl is are just 2-3 times enter |
21:46:03 | FromDiscord | <enthus1ast> good practice imho is also to let nginx deliver your static assets, not your nim application server |
21:46:56 | FromDiscord | <Isofruit> Yeh, pretty much planned to do that |
21:47:41 | FromDiscord | <Isofruit> I'm pretty much trying to recreate what I currently have.↵Which is a Django App Server which only handles the dynamic content stuff, while the Apache in front of it using HTTP 2 just serves all the static and media assets |
21:48:06 | FromDiscord | <Isofruit> (edit) "I'm pretty much trying to recreate what I currently have.↵Which is a Django App Server which only handles the dynamic content stuff, while the Apache in front of it using HTTP 2 just serves all the static and media assets ... " added "(that being user-uploaded images and mp3 recordings)" |
21:48:26 | FromDiscord | <enthus1ast> if you need a template engine i can recommend nimja (shameless plug \:D ) |
21:48:42 | FromDiscord | <Isofruit> Nah, REST Api, my frontend is Angular, thanks for the recommendation though! |
21:49:11 | FromDiscord | <Isofruit> chances are I'll want to build myself a backend-admin interface at one point or another since Django's admin interface won't be there anymore |
21:49:27 | FromDiscord | <Isofruit> (edit) "anymore" => "anymore, so at that point a template engine will likely be necessary" |
21:49:44 | FromDiscord | <enthus1ast> since years i think of a bolt cms but in nim |
21:49:57 | FromDiscord | <enthus1ast> i even have starten playing around how to do this properly |
21:50:20 | FromDiscord | <enthus1ast> and lately i also though of use an ecs (entity component system) for web stuff |
21:51:25 | * | sagax quit (Ping timeout: 240 seconds) |
21:51:37 | FromDiscord | <Isofruit> I don't think I have a mental image of ecs atm, let me google that one |
21:52:16 | FromDiscord | <enthus1ast> you have Entities (integer) , you assign Components to it (Objects) |
21:52:33 | FromDiscord | <enthus1ast> then you have systems that operate on the Components |
21:52:50 | FromDiscord | <Isofruit> So components as a bundle of entities |
21:52:58 | FromDiscord | <Isofruit> Isn't that sort of what objects in nim are? |
21:53:13 | FromDiscord | <enthus1ast> no components are the objects |
21:53:39 | FromDiscord | <Isofruit> Check, oh wow my brain really does not compute well atm |
21:53:41 | FromDiscord | <Elegantbeef> Systems in ECS query your data base for all entities with specific components then act on those components |
21:53:43 | FromDiscord | <enthus1ast> in a game a component could be eg\: Health / Mana |
21:53:52 | FromDiscord | <Elegantbeef> Components in ECS are data buckets |
21:54:17 | FromDiscord | <Elegantbeef> Entities are IDs which allow you to fetch components specifically when you need to |
21:54:53 | FromDiscord | <enthus1ast> i can imagine that it would be easy to store ecs in a db for web purpose |
21:54:58 | FromDiscord | <Isofruit> `SELECT FROM my_large_multi_table_view WHERE id = ?` ? |
21:55:22 | FromDiscord | <enthus1ast> select \ from health where id = ? |
21:55:36 | FromDiscord | <Isofruit> Sounds like database indices and queries to me |
21:55:54 | FromDiscord | <Isofruit> I might not have the who is what in that analogy correct right now but the mental mapping seems to fit |
21:57:02 | FromDiscord | <enthus1ast> yeah thing that fits quite good. one benefit is that you can model complex entities that are hard to do with inheritance |
21:58:22 | FromDiscord | <enthus1ast> eg\: a car that takes fuel, has a trunk, and can be picked up to your players inventory |
21:59:35 | FromDiscord | <enthus1ast> should it inherit from a InventoryItem or a WorldItem or a FuelConsumer or a Inventory |
22:26:26 | * | PMunch quit (Quit: leaving) |
22:42:26 | * | jmdaemon joined #nim |
22:51:37 | * | jmdaemon quit (Ping timeout: 240 seconds) |
23:18:42 | FromDiscord | <ajusa> Is incremental compilation official yet? I see GitHub issues related to it but was under the impression that it was still heavy WIP |
23:22:48 | FromDiscord | <Elegantbeef> It's still in progress i think you can try it with `--ic:on` |
23:26:31 | FromDiscord | <ajusa> `nim-#devel/lib/core/macros.nim(173, 55) Error: '[]' can only be used in compile-time context` yup still WIP looks like |
23:27:00 | FromDiscord | <hmmm> ic is going to be super huge |
23:27:07 | FromDiscord | <hmmm> I'm very excited |
23:27:10 | FromDiscord | <ajusa> `Error: unhandled exception: index 62 not in 0 .. 58 [IndexDefect]` when I do it again, so something's clearly happening incrementally, I'll be super happy when it drops |
23:27:35 | FromDiscord | <Elegantbeef> Assuming IC ever gets released 😛 |
23:27:43 | FromDiscord | <hmmm> beeeeeeef |
23:27:52 | FromDiscord | <hmmm> of course it's going to! |
23:28:59 | FromDiscord | <ajusa> https://github.com/nim-lang/Nim/commit/61fb83ecbb4c691c03d500f6c71499e59a67cef2 > three years ago, but looks like it's more a priority now so I'm hopeful |
23:29:10 | FromDiscord | <ajusa> (edit) "https://github.com/nim-lang/Nim/commit/61fb83ecbb4c691c03d500f6c71499e59a67cef2 > three years ago, but looks like it's more ... a" added "of" |
23:30:04 | FromDiscord | <Elegantbeef> Personally i just want fewer bugs |
23:30:24 | FromDiscord | <hmmm> well you are the compiler dev so get to work 🤔 |
23:30:28 | FromDiscord | <Elegantbeef> Or things that should work working |
23:30:35 | FromDiscord | <Elegantbeef> I'm "the compiler dev" |
23:31:20 | FromDiscord | <Elegantbeef> I fix bugs that I see I can fix, or as i prefer to call it "Make things that should work but dont work" |
23:32:27 | FromDiscord | <hmmm> well if it can make you sleep any easier there is an entire class of people (me) that operate at a lower level that rarely hit bugs 😃 |
23:34:52 | FromDiscord | <Elegantbeef> I mean there have been many issues i've seen in here |
23:35:09 | FromDiscord | <Elegantbeef> This chat is one place I get problems to fix! |
23:35:39 | FromDiscord | <hmmm> I'm very happy with nim, the only thing I miss is that my programs usually want to do a lot of creative stuff with user input and nim wants to know the types in advance and so it's always a struggle, doesn't help that I'm also still at baby level with macros |
23:37:23 | FromDiscord | <Elegantbeef> is reminded he needs to expand his macro tutorial more |
23:37:29 | FromDiscord | <hmmm> yes please! |
23:37:39 | FromDiscord | <hmmm> I enjoyed the mystifying series |
23:37:58 | FromDiscord | <Elegantbeef> I did add some to it removing the constructor macro cause it was pointles |
23:38:16 | FromDiscord | <hmmm> if I give you an example of simple macro to tutorial would you consider it? |
23:39:44 | FromDiscord | <Elegantbeef> Uhhh |
23:40:29 | FromDiscord | <hmmm> pft, never trust compiler devs |
23:40:37 | FromDiscord | <Elegantbeef> I'm not a compiler dev |
23:40:42 | * | greaser|q quit (Changing host) |
23:40:42 | * | greaser|q joined #nim |
23:40:50 | FromDiscord | <hmmm> compiler mechanic? |
23:40:53 | * | greaser|q is now known as GreaseMonkey |
23:41:44 | * | adigitoleo_ is now known as adigitoleo |
23:41:48 | FromDiscord | <Elegantbeef> Compiler fixer uper erer |
23:41:56 | FromDiscord | <Elegantbeef> What's the macro anyway? |
23:42:01 | FromDiscord | <Elegantbeef> Also do me a favour and read https://dev.to/beef331/demystification-of-macros-in-nim-13n8#untyped-vs-typed-macros |
23:42:29 | FromDiscord | <hmmm> again? I already read it. I stopped before the constructor |
23:42:47 | FromDiscord | <Elegantbeef> Not again |
23:42:50 | FromDiscord | <Elegantbeef> I added stuff t oit |
23:43:11 | FromDiscord | <Elegantbeef> It's actually more explanitive |
23:44:05 | FromDiscord | <hmmm> anyway first thing I would modify is "walrus operator" mention since belive it or not there is people that don't know wtf is it and get intimidated, also iirc it was only tangentially related to the matter at hand 🧐 |
23:44:37 | FromDiscord | <Elegantbeef> What? |
23:45:01 | FromDiscord | <hmmm> hehe |
23:45:05 | FromDiscord | <Elegantbeef> I explain what it does in Go so saying "walrus operator" or "`:=`" is the same thing |
23:46:07 | FromDiscord | <hmmm> hmm I never used Go and today at 00:45 is the first time I see :=, so assume lower level IQ 😃 |
23:46:45 | FromDiscord | <Elegantbeef> Anyway i was talking abour reading the new typed vs untyped section |
23:48:01 | FromDiscord | <hmmm> nu I'm nitpicking the first sentences lol. I was also confused on why you used the backticks now that I remember it |
23:48:23 | FromDiscord | <hmmm> something related to overloading? you can explain it in the article 🤔 |
23:48:28 | FromDiscord | <Elegantbeef> That's how Nim does operators, it's not teaching Nim it's teaching operators 😛 |
23:48:39 | FromDiscord | <Elegantbeef> it's teaching macros\ |
23:49:08 | FromDiscord | <hmmm> yea I know but keep in mind that most novices are curious about macros so you might consider lowering the barrier |
23:49:19 | FromDiscord | <hmmm> so they might see how powerful they are |
23:49:58 | FromDiscord | <Elegantbeef> If you dont know how to use Nim i dont see how you expect to use macros |
23:51:02 | FromDiscord | <hmmm> hmm it's more like, people that are learning nim are probably also curious about macros and your article is something they will probably see 😛 |
23:51:51 | FromDiscord | <hmmm> anyway dumptree at the start is supergood, teaching the fisher how to fish |
23:53:09 | FromDiscord | <hmmm> oh you added typed vs untyped |