01:31:52 | * | azimut quit (Remote host closed the connection) |
01:32:16 | * | azimut joined #nim |
01:48:26 | FromDiscord | <ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4Ehj |
01:48:53 | FromDiscord | <ravinder387> how to wrap context.font = "30px Arial" |
01:51:27 | FromDiscord | <ravinder387> sent a code paste, see https://play.nim-lang.org/#ix= |
01:51:35 | FromDiscord | <ravinder387> it didn't work |
01:54:14 | FromDiscord | <Elegantbeef> \`\`font = |
01:54:18 | FromDiscord | <Elegantbeef> `font = ` whoops |
01:56:20 | FromDiscord | <ravinder387> I wrote this code 1 year ago.. now I wanna extend it |
01:57:53 | FromDiscord | <ravinder387> how to wrap canvas javascript api in nim |
03:27:08 | * | fallback quit (Ping timeout: 246 seconds) |
03:27:37 | * | fallback joined #nim |
04:28:11 | FromDiscord | <k0ts> https://github.com/juancarlospaco/nodejs/blob/dbe6ac311abeda18b0b75ff3d20bcb27320b9f7b/src/nodejs/jscanvas.nim |
04:28:15 | FromDiscord | <k0ts> Might be worth a look |
04:53:43 | FromDiscord | <Phil> I dunno why but that kinda reminds me that I really should be using block more to isolate individual blocks of code that are just for figuring out the value of 1 variable |
05:01:39 | * | azimut quit (Ping timeout: 246 seconds) |
05:06:40 | * | advesperacit joined #nim |
05:25:43 | FromDiscord | <graveflo> If I make a table like `newTable[string, seq[string]]()` how do I get a reference to a seq without making a copy, as in `var s = table["something"]`. I tried `newTable[string, var seq[string]]()`. I know that `table["something"].something` will work, as in passing it into a proc or just doing the operation without defining another variable, but this is cumbersome and annoying, especially when using the built in iterators. Anyone know ho |
05:58:01 | FromDiscord | <demotomohiro> @graveflo↵Wait for view types: https://nim-lang.org/docs/manual_experimental.html#view-types↵Or pass `table["abc"]` to a proc parameter `x: seq[string]` or `x: openArray[string]`. |
06:04:58 | FromDiscord | <Phil> Is every function in JS basically an async function? |
06:05:30 | FromDiscord | <Phil> And you just don't notice it/ it gets hidden from you because JS doesn't let you interact with resources outside of the context of an event-loop? |
06:06:10 | FromDiscord | <Phil> (edit) "function?" => "function / a function on an event-loop queue (or a function that gets called by a function on an event-loop queue)?" |
06:07:26 | FromDiscord | <Phil> That question came up to me as I started realizing that `await` is kind of nim's equivalent to JS `await` , but JS basically has no equivalent to `waitFor` because in JS your functions basically are never in a synchronous context.↵It's all event-loop. Whatever code calls an equivalent to waitFor is running the JS runtime, right? |
06:08:00 | FromDiscord | <Phil> (edit) "event-loop." => "event-loop/tasks in a dispatcher-queue." |
06:08:27 | FromDiscord | <Phil> (edit) "That question came up to me as I started realizing that `await` is kind of nim's equivalent to JS `await` , but JS basically has no equivalent to `waitFor` because in JS your functions basically are never in a synchronous context.↵It's all event-loop/tasks in a dispatcher-queue. Whatever code calls an equivalent to waitFor is ... running" added "what's" |
06:17:37 | FromDiscord | <Phil> Self answered async SO question incoming |
06:19:34 | NimEventer | New question by Philipp Doerner: How do I execute a proc with a delay in nim?, see https://stackoverflow.com/questions/76958747/how-do-i-execute-a-proc-with-a-delay-in-nim |
06:25:12 | * | PMunch joined #nim |
06:34:30 | * | hernan_ joined #nim |
06:35:36 | * | blackbeard420_ joined #nim |
06:36:25 | * | Mister_Magister_ joined #nim |
06:38:14 | * | lumidify_ joined #nim |
06:38:22 | * | adium_ joined #nim |
06:38:33 | * | laintree joined #nim |
06:39:18 | * | Mister_Magister quit (*.net *.split) |
06:39:18 | * | cornfeedhobo quit (*.net *.split) |
06:39:18 | * | blackbeard420 quit (*.net *.split) |
06:39:18 | * | lumidify quit (*.net *.split) |
06:39:18 | * | adium quit (*.net *.split) |
06:39:18 | * | hernan quit (*.net *.split) |
06:39:18 | * | lain quit (*.net *.split) |
06:40:03 | * | Mister_Magister_ is now known as Mister_Magister |
06:43:39 | * | cornfeedhobo joined #nim |
06:50:31 | * | rockcavera quit (Remote host closed the connection) |
08:09:06 | * | laintree is now known as lain |
08:16:42 | * | azimut joined #nim |
08:29:05 | FromDiscord | <mratsim> In reply to @Andreas "found it yesterday, and": pick a domain and create primitives that use SIMD for it.↵↵Just the vector class isn't really that useful unless it's the backend of a compiler/DSL because now you need to teach the users how to use your class, and they might need to learn SIMD as well. |
08:29:42 | FromDiscord | <mratsim> something like this for example: https://github.com/ermig1979/Simd |
09:32:52 | NimEventer | New thread by leeooox: Nim2.0 how to build dll without dependency of libgcc_s_seh-1.dll, see https://forum.nim-lang.org/t/10431 |
09:40:42 | * | lucasta_ joined #nim |
10:09:55 | PMunch | Hmm, more of a general code style question, but how do people handle procedures which takes a lot of parameters? |
10:10:26 | PMunch | I have a set of procedures which all simulate some stuff based on an initial state with a bunch of parameters |
10:11:21 | PMunch | The way I've done it is to split up the parameters in objects and pass those in. But now I'm left in a scenario where some procs require certain parameters to be set, while other don't |
10:21:51 | * | def- quit (Quit: -) |
10:22:04 | * | def- joined #nim |
10:22:46 | FromDiscord | <nnsee> I'm not sure if I'm understanding you correctly, but can't you just ignore the parameters that aren't required to be set (and also just not set them in the object in the firs place)? |
10:27:08 | FromDiscord | <Phil> In reply to @PMunch "I have a set": Sounds like that's state and you have a state object in disguise |
10:27:43 | FromDiscord | <Phil> Oh wait, you have a bunch of parameters for different procs, hmm |
10:29:39 | PMunch | Yeah basically I want to be able to define some initial state of the system, then call various procedures to simulate stuff based on this state |
10:29:57 | FromDiscord | <Phil> In reply to @PMunch "The way I've done": Generally my strategies are depending on the situation:↵- 1 x State object parameter↵- Default Parameter↵- Overloads - this one mostly if a proc may be called with different sets of parameters, then I basically overload that proc as various "frontends" for the main proc |
10:30:30 | FromDiscord | <Phil> In reply to @PMunch "Yeah basically I want": So all parameter-subsets are derived from the initial state? |
10:30:46 | PMunch | Hmm, I guess I could make the basic parts of the calculation just take numbers, then have unpacking templates which takes the values from the state object.. |
10:31:02 | FromDiscord | <Phil> In that case I think it'd be valid to have a state object for each parameter-set and write mappers to convert from state-object A to B |
10:31:39 | PMunch | Hmm, I think I might just need some verifiers |
10:31:46 | FromDiscord | <Phil> Particularly since that also forces you to centralize thinking about scenarios of "Where does a parameter value come from when A has it but B doesn't" |
10:32:30 | FromDiscord | <Phil> Also valid, I can't say I've found "the" strategy yet. In Webdev the solution is obvious:↵You have your 3 layer architecture and you pass well-defined data-containers back and forth |
10:34:09 | FromDiscord | <Phil> A controller will always build a controller-based-object whatever you want to call it, which accumulates all relevant data from the HTTP request (be it from the URL path, the headers, the body, cookies or tokens) and passes that on to a service, which does what it needs to with that data and returns the desired data-object that can be JSON-serialized (or turned into HTML) and sent to the world. |
10:34:34 | FromDiscord | <Phil> (edit) "data-object that" => "data-object, which the Controller then" | "data-object, which the Controller thencan ... befor" added "transform into whatever shape it wants it to" | "JSON-serialized" => "for JSON-serialization" | "turned" => "turn" |
10:35:45 | FromDiscord | <Phil> The service layer for its job calls the repository layer, which contains DB representations of your data and transforms that into the actual business-obejcts you wants |
10:35:54 | FromDiscord | <Phil> (edit) "business-obejcts" => "business-objects" | "wants" => "want in your services" |
10:57:28 | FromDiscord | <xeamek> Is it just me, or is play.nim-lang.org down? |
10:58:02 | PMunch | It is indeed |
10:58:11 | PMunch | @Phil, do you want to give it a go? |
10:58:28 | FromDiscord | <Phil> on it |
11:00:09 | PMunch | Hmm, I think there might actually be a log file which grows too big |
11:01:03 | FromDiscord | <Phil> Reboot it was |
11:01:17 | PMunch | Yeah that clears the log file |
11:01:34 | FromDiscord | <Phil> Ah shit, should've checked that first |
11:02:43 | PMunch | I snuck in before you and did ;) |
11:03:00 | PMunch | The /tmp/nim_playground.log grows unbounded, filling up the disk |
11:03:30 | PMunch | Reboot deletes everything in /tmp (even though it's not mounted as a tmpfs on this machine) |
11:04:50 | FromDiscord | <Phil> Wait we haven't set up a rule for that |
11:04:55 | FromDiscord | <Phil> (edit) "that" => "that?" |
11:05:13 | FromDiscord | <Phil> Oh wait, nim_playground.log, not journalctl |
11:09:24 | PMunch | Yeah, we should probably just move all those file logging statements to simple echo statements and let journalctl deal with it |
11:34:11 | * | jmdaemon quit (Ping timeout: 245 seconds) |
11:52:02 | FromDiscord | <xeamek> Could You help me understand why this type of iteration doesn't compile (but the commented out does)?↵https://play.nim-lang.org/#ix=4EiK |
12:00:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EiM |
12:00:45 | PMunch | Same.. |
12:06:31 | FromDiscord | <xeamek> #for i in 0..<next.len: |
12:06:34 | FromDiscord | <xeamek> (edit) "#for" => "for" |
12:07:03 | PMunch | That would work as well |
12:07:11 | PMunch | Same with `for i in 0..next.high` |
12:07:37 | PMunch | Those `var State` elements in your object is not allowed though |
12:08:03 | PMunch | `var` is only used to declare variables, and pass editable arguments to functions |
12:10:26 | FromDiscord | <xeamek> ah, I see now |
12:11:03 | FromDiscord | <xeamek> thx |
12:12:56 | PMunch | It should have told you this in the compilation error by the way. Didn't you get something like "unexpected var in object declaration"? |
12:15:26 | * | blackbeard420_ quit (Quit: ZNC 1.8.2 - https://znc.in) |
12:15:40 | * | blackbeard420 joined #nim |
12:19:35 | FromDiscord | <burnysc2> sent a code paste, see https://play.nim-lang.org/#ix=4EiR |
12:21:47 | PMunch | burnysc2, unfortunately `case` is not able to work like a `when` statement. |
12:22:33 | PMunch | The compiler is of course different, because your code and types are all runtime values to it, so it would be using an `if` if it weren't for the case. |
12:23:31 | PMunch | Of course in this case you could just do a simple overload |
12:24:43 | PMunch | https://play.nim-lang.org/#ix=4EiU |
12:30:45 | FromDiscord | <burnysc2> thank you, i haven't thought about trying to use overloading like this for this case |
12:58:36 | PMunch | The easiest solution is sometimes the best |
13:15:30 | * | rockcavera joined #nim |
14:08:04 | * | PMunch quit (Remote host closed the connection) |
14:08:24 | * | PMunch joined #nim |
14:25:37 | * | PMunch quit (Quit: Leaving) |
14:37:17 | FromDiscord | <heysokam> @pmunch I take the Vulkan approach, with temporary objects that take options and are named depending on their usecase↵That way I can set default values for the objects in the objects themselves, without poluting the functions with 10mill parameters |
14:52:35 | FromDiscord | <xeamek> sent a code paste, see https://play.nim-lang.org/#ix=4Ejq |
14:55:59 | FromDiscord | <Prestige> Previously I was able to cast a string to a Pcuchar, now it's a compiler error. How can I provide a `Pcuchar` to a function now (that's pointing at a string)? |
15:10:39 | FromDiscord | <duskhorn> sent a code paste, see https://play.nim-lang.org/#ix=4Ejy |
15:14:34 | * | lucasta_ quit (Ping timeout: 246 seconds) |
15:31:20 | FromDiscord | <odexine> Because it’s gated behind a statement that checks if you’re not on windows? |
15:38:23 | FromDiscord | <duskhorn> In reply to @odexine "Because it’s gated behind": I'm so stupid LOL |
15:38:44 | FromDiscord | <odexine> We all got them moments don’t worry lol |
15:39:05 | FromDiscord | <duskhorn> So how am I supposed to create a new X509_STORE? |
15:39:57 | FromDiscord | <duskhorn> Like, I can't use that on windows at all from Nim? Do I create my own wrapper? |
15:40:43 | FromDiscord | <jviega> I pointed you to the answer to this a couple of days ago |
15:41:06 | FromDiscord | <duskhorn> In reply to @jviega "I pointed you to": yeah, I'm following that answer |
15:41:39 | FromDiscord | <jviega> Here's some C you can adapt it into something you {.emit.} and wrap: |
15:41:39 | FromDiscord | <duskhorn> my problem is another one right now. I just discovered I can't use some of nim's openssl module lol |
15:41:45 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4EjG |
15:42:37 | FromDiscord | <jviega> That code creates an X509 store, populating it from the Windows store. You just need it to return you a reference in Nim |
15:43:24 | FromDiscord | <duskhorn> sent a code paste, see https://play.nim-lang.org/#ix=4EjH |
15:44:06 | FromDiscord | <duskhorn> https://github.com/nim-lang/Nim/blob/ef63d47ecd10b4f1cd96da7a491a85fee6ab5965/lib/wrappers/openssl.nim#L833 |
15:44:57 | FromDiscord | <jviega> I don't understand your issue, you just importc them yourself |
15:45:41 | FromDiscord | <jviega> For this: |
15:45:46 | FromDiscord | <odexine> The library probably needs updating anyway, maybe open an issue |
15:45:47 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4EjI |
15:46:00 | FromDiscord | <duskhorn> In reply to @jviega "I don't understand your": yeah I can't do much more |
15:47:30 | FromDiscord | <jviega> Worst case, just edit your local version of the openssl wrapper |
15:47:47 | FromDiscord | <duskhorn> sent a code paste, see https://play.nim-lang.org/#ix=4EjJ |
15:48:35 | FromDiscord | <jviega> That importc is nim declaring that the function it names available in C. You will need to call it. It does NOT populate the cert store |
15:48:46 | FromDiscord | <jviega> The C code above populates the cert store |
15:48:50 | FromDiscord | <duskhorn> of course, I understand how importc works |
15:48:55 | FromDiscord | <duskhorn> ah alright |
15:49:16 | FromDiscord | <duskhorn> so instead of creating a new one like in the snippet, you get the cert store one |
15:51:17 | FromDiscord | <jviega> Once you've told OpenSSL where the cert store is, you will only need to do something like: let context = newContext(verifyMode = CVerifyPeer) |
15:51:19 | FromDiscord | <jviega> client = newHttpClient(sslContext=context, timeout=timeout) |
15:51:38 | FromDiscord | <jviega> Hit enter before formatting sorry |
15:51:42 | FromDiscord | <jviega> You get the idea |
15:51:53 | FromDiscord | <jviega> Timeout is in ms, so 5000 is a decent number |
15:52:54 | FromDiscord | <duskhorn> In reply to @jviega "Once you've told OpenSSL": ok! That's what I figured \:D↵the problem was the whole snippet above. Thanls |
15:52:56 | FromDiscord | <duskhorn> (edit) "Thanls" => "Thanks" |
15:55:05 | FromDiscord | <jviega> Yeah, obviouly rename it from main(), but then you'll need to take the X509 store you've just copied from Windows and tell OpenSSL to use it |
15:55:15 | FromDiscord | <jviega> That's easy though: https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set1_cert_store.html |
15:56:11 | FromDiscord | <jviega> The version of the function with the '1' transfers memory ownership, so you shouldn't then free |
15:57:52 | FromDiscord | <jviega> Oh whoops, opposite, 1 doesn't transfer |
15:58:07 | FromDiscord | <jviega> The 0's transfer |
16:01:10 | FromDiscord | <duskhorn> In reply to @jviega "Yeah, obviouly rename it": alr, is there an easy way to test if this works? |
16:01:26 | FromDiscord | <Chronos [She/Her]> Ngl I wonder how difficult it'd be to reimplement Nim's parser from scratch |
16:01:34 | FromDiscord | <Chronos [She/Her]> For no other reason other than curiosity |
16:01:47 | FromDiscord | <Chronos [She/Her]> Macros would probably break but oh well |
16:02:10 | FromDiscord | <jviega> Use it to hit a big web site like google and check the return value |
16:08:13 | NimEventer | New post on r/nim by angel__-__-: nvim treesitter for nim on macOS?, see https://reddit.com/r/nim/comments/15z86zj/nvim_treesitter_for_nim_on_macos/ |
16:15:12 | NimEventer | New thread by Allin: GuildenStern web server 6.0.0 is here, see https://forum.nim-lang.org/t/10433 |
16:19:13 | NimEventer | New thread by Allin: SQLiteral db driver 4.0.0 is here, see https://forum.nim-lang.org/t/10434 |
16:27:00 | FromDiscord | <jviega> @duskhorn if you have it working, definitely is worth a PR |
16:56:56 | FromDiscord | <duskhorn> In reply to @jviega "<@786958459878637589> if you have": nah it's not working |
16:58:08 | FromDiscord | <duskhorn> I give up |
17:05:53 | FromDiscord | <jviega> Lol if I were a windows person in the slightest I'd help you out, but I haven't done any windows dev since 3.1 |
17:11:34 | * | def- quit (Quit: -) |
17:11:46 | * | def- joined #nim |
17:19:33 | FromDiscord | <saint._._.> https://nim-lang.org/docs/sets.html#HashSet |
17:20:03 | FromDiscord | <saint._._.> Etc? |
17:20:06 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Ek7 |
17:20:15 | FromDiscord | <saint._._.> It seems kinda confusing to figure out how to use a set just from the docs here |
17:20:24 | FromDiscord | <saint._._.> Wondering if people think that sort of example is unnecessary |
17:40:06 | * | azimut quit (Ping timeout: 246 seconds) |
17:43:36 | FromDiscord | <jviega> sent a long message, see http://ix.io/4Eki |
17:52:44 | FromDiscord | <pmunch> Give me a minute, I just have to pack some tools away |
17:52:55 | FromDiscord | <jviega> No hurry, thanks very much |
18:08:29 | FromDiscord | <pmunch> sent a long message, see http://ix.io/4Eko |
18:10:48 | FromDiscord | <jviega> No the int n is a pointer to the length. I am pretty sure when I tried ptr UncheckedArray[fooT] I was getting an error, hmm. And then how about a destructor for such a thing? Obviously I just need it to proxy to free but I couldn't figure out the syntax. |
18:11:05 | FromDiscord | <jviega> And retype was telling me I could only retype fields, not the parameters |
18:11:18 | FromDiscord | <saint._._.> How do you do optional parameters in a proc in nim? Do I have to do Option[type] ? |
18:11:33 | FromDiscord | <jviega> Meaning the caller can optionally provide them? |
18:11:53 | FromDiscord | <jviega> Because if so, you can just provide a default value |
18:24:02 | FromDiscord | <saint._._.> I wanted to check if it was used or not |
18:24:12 | FromDiscord | <saint._._.> But I think I figured it out, I have to use Option[] |
18:24:16 | FromDiscord | <saint._._.> And then check isSome |
18:24:16 | FromDiscord | <jviega> Then Option is your best bet |
18:24:22 | FromDiscord | <saint._._.> Is that right? |
18:24:26 | FromDiscord | <jviega> Yes |
18:24:37 | FromDiscord | <jviega> It's a bit clunky/verbose but it's the way to do it |
18:30:03 | FromDiscord | <saint._._.> @jviega If I put a parameter as Option and don't include it it says missing parameter |
18:30:54 | FromDiscord | <jviega> `proc x(x: Option[SomeType] = none(SomeType)) = ...` |
18:30:59 | FromDiscord | <jviega> That sets a default value. |
18:31:39 | FromDiscord | <jviega> You can do the same thing w/o option if there's a canonical value that is "empty", but then you're not forced to check it. Still, I'll still do it with strings: |
18:32:38 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4Ekw |
18:34:44 | FromDiscord | <jviega> For objects, `none(ObjType)` should generally work, and if it's a ref object, soft cast of nil will def work (eg, `x: RefType = RefType(nil)`) |
18:35:38 | FromDiscord | <jviega> The later would be if you're willing to not have the force to do the nil check; I personally still wrap that in an Option[] |
18:42:07 | FromDiscord | <pmunch> Hmm, for destructors you'll have to use some tricks with distinct I believe. I would have to look at some of my old code to figure it out. If @ElegantBeouf is around he might remember how to do it |
18:43:14 | FromDiscord | <saint._._.> Oh okay thanks @jviega |
18:44:51 | FromDiscord | <Elegantbeef> `type MyObject = distinct MyRef` |
18:45:08 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EkA |
18:45:14 | FromDiscord | <jviega> Okay, at some point when I have some real time, it'd be good to produce more docs on this kind of stuff to help people put more high level interfaces on top of the output |
18:45:26 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4EkA" => "https://play.nim-lang.org/#ix=4EkB" |
18:46:17 | FromDiscord | <Elegantbeef> Phil it means memory was used before it was initialised |
18:46:54 | FromDiscord | <Elegantbeef> Which means you practically did `var i = createU(int); i[] += 1` |
18:47:02 | FromDiscord | <Phil> But that seems like the kind of thing that should've super blown up in my face |
18:48:09 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EkD |
18:48:59 | FromDiscord | <Phil> It should be noted that all types of x are ref-types |
18:49:24 | FromDiscord | <Phil> (edit) "ref-types" => "ref-types, so the first part is me figuring out the memory location for debugging purposes, which that dollar proc is for" |
18:51:58 | FromDiscord | <Phil> Basically every single use of `fmt` is showing up as a valgrind error |
18:52:02 | FromDiscord | <Phil> Which I'm not sure what to think of |
18:56:18 | FromDiscord | <jviega> I've not bothered in the slightest to run valgrind on my nim because I've continued to use refc, which, as long as it's not dropping roots in the std library somewhere, should be fine. Could easily imagine false positives too. |
18:57:03 | FromDiscord | <Phil> Aaaand this is the kind of reason I was asking because I wasn't even sure if valgrind does false positives / what the general "vibes" around it are. |
18:57:35 | FromDiscord | <Phil> Because I do not have the expertise to test the validity of this stuff myself, so I have to trust the tools that I use are good at what they do. |
18:59:09 | FromDiscord | <Phil> What massively confuses me though is that apparently I don't get memory leaks even if I do not unsubscribe |
18:59:10 | FromDiscord | <sirolaf> Try with `-d:useMalloc` |
18:59:12 | FromDiscord | <Phil> Which is like... what? |
18:59:46 | FromDiscord | <Phil> Note that I'm writing a lib there, so I'm mostly trying to make sure I don't screw anyone over with memory leaks |
19:00:01 | FromDiscord | <Phil> I can't really assume that every user will use `-d:useMalloc` |
19:00:27 | FromDiscord | <sirolaf> They won't but valgrind doesn't work without malloc because nim does some stuff it doesn't understand afaik |
19:00:49 | FromDiscord | <Phil> Ohhhhhhhh |
19:01:36 | FromDiscord | <Phil> Oh hey that almost halved the error count, down to ~300 |
19:02:04 | FromDiscord | <Phil> And some of the errors come from code that is not mine...? |
19:03:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EkH |
19:04:38 | FromDiscord | <Phil> But apparently those make up at least a third of the errors (around 100) |
19:04:52 | FromDiscord | <Phil> (edit) "at least" => "around" |
19:05:58 | FromDiscord | <sirolaf> Use arc/orc, assume this is refc |
19:06:40 | FromDiscord | <Phil> It is in fact orc |
19:07:04 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EkI |
19:07:28 | FromDiscord | <jviega> Oh last n times I've run orc, it's leaked like a sieve. I'm sure it's better now, but I won't be moving over anytime soon. |
19:08:46 | FromDiscord | <Phil> Amount of errors between orc and refc is pretty much unchanged |
19:09:20 | FromDiscord | <Phil> So the vibes I'm getting is that valgrind is a bit overeager in its reporting to the point of not being useful? |
19:17:38 | FromDiscord | <Phil> In reply to @jviega "Oh last n times": Out of curiosity, how did you notice that?↵Just practical tests ala letting the code run over and over again and watching your memory useage?↵Valgrind? |
19:17:53 | FromDiscord | <Phil> (edit) "useage?↵Valgrind?" => "useage?↵Valgrind?↵Basically, what are the things to look at?" |
19:22:10 | FromDiscord | <sirolaf> <https://github.com/nim-lang/Nim/issues/22510> there is also this issue, so if there is a leak it might not be your fault |
19:23:24 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EkL |
19:40:56 | FromDiscord | <Andreas> sent a long message, see http://ix.io/4EkP |
19:44:12 | * | advesperacit quit (Ping timeout: 248 seconds) |
19:49:10 | * | advesperacit joined #nim |
20:01:40 | FromDiscord | <saint._._.> Anyone know how to get the "innerHTML" of an xml node in nim? |
20:01:52 | FromDiscord | <saint._._.> So the content without the main tag |
20:04:05 | FromDiscord | <saint._._.> I think innertext doesnt work cause it doesn't include nested tags |
20:08:09 | FromDiscord | <Elegantbeef> @heysokam\: https://play.nim-lang.org/#ix=4EkZ works fine |
20:15:08 | FromDiscord | <jviega> @Phil can tell when memory is growing over time much faster that it is when it's using the gc, etc. |
20:16:02 | FromDiscord | <jviega> That post SirOlaf posted would represent the best experience I had. |
20:20:48 | FromDiscord | <.maverk> does nim have interface like golang ? |
20:21:14 | FromDiscord | <Elegantbeef> Not in the language but people have made libraries like iface to add it |
20:21:35 | FromDiscord | <Elegantbeef> You can get a lot of development done using generic interfaces that are statically dispatched |
20:22:02 | FromDiscord | <.maverk> In reply to @Elegantbeef "Not in the language": i am not a fan of interfaces |
20:22:11 | FromDiscord | <.maverk> i hate them hhhh |
20:22:16 | FromDiscord | <Elegantbeef> So then why did you ask |
20:22:30 | FromDiscord | <.maverk> just because of ai |
20:22:37 | FromDiscord | <.maverk> i asked it and said yes |
20:22:42 | FromDiscord | <.maverk> so i had to make sure |
20:23:50 | FromDiscord | <Andreas> well, so thats how AI improves human communications - welcome to the future |
20:36:50 | * | jmdaemon joined #nim |
21:08:21 | * | advesperacit quit () |
21:10:06 | FromDiscord | <BanannaMan> sent a long message, see http://ix.io/4Elb |
21:10:17 | FromDiscord | <BanannaMan> (edit) "http://ix.io/4Elb" => "http://ix.io/4Elc" |
21:14:02 | FromDiscord | <heysokam> In reply to @BanannaMan "Hey guys, what's the": RootObj has inheritance capabilities |
21:14:08 | FromDiscord | <juan_carlos> In reply to @BanannaMan "Hey guys, what's the": Add asterisk to things that need to be public only. |
21:15:48 | FromDiscord | <heysokam> as for the public/private, you will know as soon as you start to develop an specific application with specific needs↵but basically its a way to stop parts of the object from being accessed when they should not be accessed from other modules↵In short, make things private by default (aka dont add the ) and then add it when you need things from that object in another module |
21:15:48 | FromDiscord | <BanannaMan> In reply to @juan_carlos "Add asterisk to things": I know but if I add the asterisk to the type object, will that also make the fields public? |
21:15:59 | FromDiscord | <heysokam> In reply to @BanannaMan "I know but if": no, only the object itself |
21:16:05 | FromDiscord | <heysokam> even if its the type |
21:16:19 | FromDiscord | <juan_carlos> In reply to @BanannaMan "I know but if": Nope. |
21:16:28 | FromDiscord | <heysokam> you can have an exported/public type, that has multiple fields internally and you didnt make any of them public |
21:17:17 | FromDiscord | <BanannaMan> Oh okay |
21:17:37 | FromDiscord | <BanannaMan> In reply to @heysokam "as for the public/private,": What is the point of making things private be default? |
21:17:56 | FromDiscord | <BanannaMan> (edit) "be" => "by" |
21:18:31 | FromDiscord | <heysokam> In reply to @BanannaMan "What is the point": safety by default↵the compiler will scream at you by default, which is a really good thing |
21:18:51 | FromDiscord | <heysokam> if it was public by default, but you didn't want it public, and that is bug-inducing, then you would be in trouble |
21:19:01 | FromDiscord | <BanannaMan> I thought that it was to prevent reverse engineering lol |
21:19:29 | FromDiscord | <heysokam> nah, its just so the compiler screams at you when you forget it |
21:19:44 | FromDiscord | <BanannaMan> In reply to @heysokam "if it was public": Ah okay. So make my type objects private and then depending on field usage, selectively make those public for use in other modules? |
21:19:58 | FromDiscord | <heysokam> In reply to @BanannaMan "Ah okay. So make": yeah, as a general rule that's the mindset |
21:20:17 | FromDiscord | <BanannaMan> Alright thanks. Wish me luck on my complicated ass project |
21:28:02 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Elj |
21:29:59 | FromDiscord | <heysokam> is there a way to assert that a function instance of a generic does-not exist? 🤔 |
21:31:56 | FromDiscord | <heysokam> i know i can just call it and make the compiler crash on missing function, but wonder if I can assert that it doesn't exist and still compile normally, and pass the `check doesntExist` in the unittests |
21:34:09 | FromDiscord | <Phil> In reply to @jviega "<@180601887916163073> can tell when": So basically you were running your binary and monitoring your system's memory consumpion with htop or similar? |
21:34:53 | FromDiscord | <jviega> Yeah and generally it was obvious stuff was wrong fast. It was leaking badly enough you'd get performance issues or even crashes |
21:38:22 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Ell |
21:39:16 | FromDiscord | <jviega> Well, you are well served to do some load testing / performance testing |
21:40:29 | FromDiscord | <Phil> Eh, fair, might as well write a small test-suite that fires against the production server to see if it keels over |
22:05:08 | * | azimut joined #nim |
22:31:57 | FromDiscord | <.maverk> is there a yield keyword like python in nim ? |
22:32:19 | FromDiscord | <.maverk> i want to keep returning from a function |
22:38:24 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Elx |
22:38:42 | FromDiscord | <heysokam> iterator are a specific type of template for this usecase |
22:39:58 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4Ely |
22:40:10 | FromDiscord | <heysokam> In reply to @.maverk "what is iterator ?": a template that keeps returning |
22:41:29 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4ElC |
22:42:33 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4ElD |
22:42:47 | FromDiscord | <.maverk> sent a code paste, see https://paste.rs/oBnJ5 |
22:42:57 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4ElF |
22:43:03 | FromDiscord | <heysokam> you need to call it in a for loop |
22:43:44 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4ElG |
22:44:29 | FromDiscord | <.maverk> it works |
22:45:12 | FromDiscord | <.maverk> thanks brother |