00:00:20 | FromDiscord | <pyolyokh> <https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement> |
00:00:35 | FromDiscord | <MadScientistCarl> I see |
00:01:39 | FromDiscord | <Elegantbeef> All types are 0 init'd in Nim |
00:02:25 | FromDiscord | <MadScientistCarl> Hmmm |
00:02:36 | FromDiscord | <MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4lf8 |
00:03:04 | FromDiscord | <pyolyokh> procs have types, there are two of them in that message, and those two procs have different arguments |
00:03:19 | FromDiscord | <pyolyokh> `string` isn't `varargs[string]` |
00:03:58 | FromDiscord | <pyolyokh> the visual noise is from the <https://nim-lang.org/docs/manual.html#effect-system> |
00:04:07 | FromDiscord | <sealmove> I have a stream that is constantly being appended to. I want to read up until the last line that is available at the moment without blocking. |
00:04:08 | FromDiscord | <pyolyokh> because those can also matter, although they don't here |
00:04:11 | FromDiscord | <sealmove> How do I do it? |
00:04:41 | FromDiscord | <planetis> Something to do with the srcDir, the package needs fixing for sure.↵(@voidwalker) |
00:05:08 | FromDiscord | <voidwalker> `nimble install ffmpeg@#head ` worked |
00:05:56 | FromDiscord | <pyolyokh> In reply to @รєคɭ๓๏שє "I have a stream": use selectors <https://nim-lang.org/docs/selectors.html> or concurrency (async, futures, threads) |
00:10:12 | * | Guest1 joined #nim |
00:10:29 | * | Guest1 quit (Client Quit) |
00:11:59 | FromDiscord | <MadScientistCarl> Do I have to use a `ref` for a tagged union? |
00:12:09 | FromDiscord | <sealmove> In reply to @pyolyokh "use selectors <https://nim-lang.org/docs/selectors.": looks complicated :p will try |
00:12:10 | FromDiscord | <Elegantbeef> No |
00:13:29 | FromDiscord | <pyolyokh> the very first example at <https://nim-lang.org/docs/manual.html#types-object-variants> isn't an object ref |
00:14:05 | FromDiscord | <MadScientistCarl> Huh, I see an example with ref instead |
00:14:17 | FromDiscord | <MadScientistCarl> Oh, `Node` is not required? |
00:14:20 | FromDiscord | <Elegantbeef> I mean they can be ref |
00:14:41 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lfa |
00:14:42 | FromDiscord | <Elegantbeef> It's required for the API they use since they have a mutally recursive type |
00:14:55 | FromDiscord | <Elegantbeef> It can be a node tree so it needs a ref indirection |
00:15:00 | FromDiscord | <MadScientistCarl> Ah, right |
00:15:11 | FromDiscord | <Elegantbeef> Otherwise you need infinite stack |
00:15:16 | FromDiscord | <Elegantbeef> And i think the laws of physics prevent that |
00:16:19 | FromDiscord | <MadScientistCarl> Also, just how are enums namespaced? Do I have to invent a prefix for every enum? |
00:16:30 | FromDiscord | <pyolyokh> nah, you just need refinement types, like in ATS. Then your `NodeObj(2)` can clearly only need stack space for a 2-deep tree |
00:16:38 | FromDiscord | <MadScientistCarl> I am not completely understanding how `{.pure.}` works, based on its description |
00:16:49 | FromDiscord | <Elegantbeef> They arent namespaced |
00:16:54 | FromDiscord | <pyolyokh> pure takes the name of the enum as a namespace |
00:16:59 | FromDiscord | <Elegantbeef> Use `--overloadableEnums` and be happy |
00:17:10 | FromDiscord | <Elegantbeef> Sorry `--experimental:overloadableEnums` |
00:17:14 | FromDiscord | <Elegantbeef> Or is it overridable enums |
00:17:30 | FromDiscord | <scipio> sent a code paste, see https://play.nim-lang.org/#ix=4lfb |
00:18:00 | FromDiscord | <pyolyokh> In reply to @scipio "What could be the": having a variable named `let`, normally not possible. Also variables with spaces in them. More commonly, actually, usefully: defining operators. |
00:18:42 | FromDiscord | <pyolyokh> it's also an option when you're binding a library that has an object field named 'type', and you want to stay closer to the bound API |
00:19:23 | FromDiscord | <Elegantbeef> It's used to define operators and allows calling things directly |
00:19:24 | FromDiscord | <Elegantbeef> That will be recusive |
00:19:25 | FromDiscord | <Elegantbeef> recursive\ |
00:19:25 | FromDiscord | <Elegantbeef> But it also allows removing meaning from Nim keywords if you're into that horrid code |
00:19:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfc |
00:19:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/pvB |
00:19:33 | FromDiscord | <pyolyokh> <https://nim-lang.org/docs/manual.html#generics-implicit-generics> second example uses stropping to define `==` |
00:19:55 | FromDiscord | <Elegantbeef> Meh binding isnt really an argument imo |
00:20:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfd |
00:20:30 | FromDiscord | <Elegantbeef> YMMV on that though |
00:21:40 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lfe |
00:21:56 | FromDiscord | <scipio> @pyolyokh so basically "interoperability" is a prime usecase for stropping |
00:21:57 | FromDiscord | <pyolyokh> (edit) "https://play.nim-lang.org/#ix=4lfe" => "https://play.nim-lang.org/#ix=4lff" |
00:21:58 | FromDiscord | <Elegantbeef> I say good riddance 😛 |
00:22:07 | FromDiscord | <Elegantbeef> Not really |
00:22:41 | FromDiscord | <pyolyokh> In reply to @scipio "<@803214225002463283> so basically "interoperabilit": no. Primary usecase is operators. Last example shows how it's not great for interoperability. |
00:22:57 | FromDiscord | <Elegantbeef> There's also a 'hidden' template feature of stropping |
00:23:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfg |
00:24:04 | FromDiscord | <pyolyokh> I feel like that's a different thing that shares the syntax. Manual even says "backticks notation" instead of stropping |
00:24:29 | FromDiscord | <Elegantbeef> I consider it the same thing, but only cause it's parsed the same |
00:24:31 | FromDiscord | <pyolyokh> eh, although "stropping" only shows up once. Might just not be a favored term |
00:25:01 | FromDiscord | <Elegantbeef> It's lexical stropping since it removes semantics |
00:25:12 | FromDiscord | <Elegantbeef> The example of properties for instance |
00:25:26 | FromDiscord | <Elegantbeef> The compiler doesnt attempt to call `host=` or w/e |
00:26:31 | FromDiscord | <pyolyokh> ah yeah, another good example of them, `destroy=` |
00:26:39 | FromDiscord | <Elegantbeef> `=destroy` 😛 |
00:27:16 | FromDiscord | <Elegantbeef> `destroy=` would be a property setter named destroy |
00:27:19 | FromDiscord | <scipio> Another question I have (while learning Nim via small assignments I give myself while reading the docs) is what would be a preferred modus operandi for structuring projects.↵↵I tend to grow one `.nim` file I notice. Also, when compiling the binary is placed in my `src/` folder, can that be changed via some configuration flag? |
00:27:37 | FromDiscord | <Elegantbeef> `--outDir` and `--out` for dir/name |
00:27:54 | FromDiscord | <Elegantbeef> The way to write Nim is to make a module for things that are module-like |
00:31:29 | FromDiscord | <pyolyokh> nimble cares about source location, nim doesn't as much. code layout's guided by↵a. files importing to a module named after the file↵b. code ordering mattering in general (have to define `foo` before you call `foo()`)↵you can put everything related to a type in a file with the type definition, or you can start to the fight the system |
00:37:51 | FromDiscord | <scipio> What would you say is the core reason why the red team community likes Nim? Would language features like stropping, UFCS, case insensitivity and meta programming be among them? |
00:39:13 | FromDiscord | <pyolyokh> is that even the case? If so, I imagine it's more that there are Python and Go books about the subject, and there are good reasons to dislike both languages (speed; verbosity) |
00:39:18 | FromDiscord | <MadScientistCarl> How do I actually use a tagged union in a proc? |
00:39:27 | FromDiscord | <pyolyokh> You use it the same as anything else |
00:39:30 | FromDiscord | <Elegantbeef> You put the type in the proc |
00:39:40 | FromDiscord | <Elegantbeef> Nim's tagged unions are not like Rust's enum |
00:39:41 | FromDiscord | <Ayano> anyway to bitshift like in java "<<" |
00:39:46 | FromDiscord | <Ayano> (edit) ""<<"" => ""<<"?" |
00:39:47 | FromDiscord | <MadScientistCarl> Yes? But how do I match on kind? |
00:39:50 | FromDiscord | <Elegantbeef> There is one type it's the name of the type |
00:39:50 | FromDiscord | <Elegantbeef> `shl` |
00:39:53 | FromDiscord | <Elegantbeef> `case kind` |
00:39:54 | FromDiscord | <cow> In reply to @scipio "What would you say": statically compiled, small binaries with no runtime required is probably a factor |
00:40:07 | FromDiscord | <cow> In reply to @Ayano "anyway to bitshift like": shl and shr |
00:40:09 | FromDiscord | <Ayano> In reply to @Elegantbeef "`shl`": that throws me a couple of errors when using it sadly |
00:40:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfl |
00:40:34 | FromDiscord | <cow> In reply to @Ayano "that throws me a": what errors |
00:40:35 | FromDiscord | <Elegantbeef> Well if only the error provided diagnostics that could help solve this issue |
00:40:48 | FromDiscord | <Elegantbeef> We like seeing errors when they happen |
00:40:48 | FromDiscord | <Ayano> In reply to @cow "what errors": https://media.discordapp.net/attachments/371759389889003532/1063981036796649472/image.png |
00:40:51 | FromDiscord | <Elegantbeef> It makes it easier to help you |
00:40:56 | FromDiscord | <MadScientistCarl> Yeah, but do I just access the fields without compiler checks? |
00:41:12 | FromDiscord | <Elegantbeef> value is int |
00:41:14 | FromDiscord | <pyolyokh> In reply to @Ayano "": focus on the words like 'int', 'uint8', in that message |
00:41:17 | FromDiscord | <Elegantbeef> Yes you do |
00:41:24 | FromDiscord | <Elegantbeef> Nim doesnt have pattern matching or ADT behaviour |
00:41:27 | FromDiscord | <Elegantbeef> It has runtime checks |
00:41:42 | FromDiscord | <Ayano> In reply to @pyolyokh "focus on the words": the docs said that it could be int, so i am confused why it is not liking it |
00:41:51 | FromDiscord | <Elegantbeef> cause it's `int or int8` |
00:41:59 | FromDiscord | <Elegantbeef> You need to do `value or int(...)` |
00:42:00 | FromDiscord | <cow> you can't bitwise or an int and uint8 |
00:42:03 | FromDiscord | <pyolyokh> In reply to @MadScientistCarl "Yeah, but do I": there are compiler checks. If you branch into a case the object has the appropriate variant in that case. |
00:42:28 | FromDiscord | <cow> or you need to have var value = 0'u8 if you want uint8 value |
00:43:15 | FromDiscord | <cow> but from context, you probably want to convert curByte to int first |
00:43:25 | FromDiscord | <cow> (edit) "curByte" => "(curByte...)" |
00:43:27 | FromDiscord | <huantian> In reply to @pyolyokh "there *are* compiler checks.": The compiler checks are kinda lackluster tho |
00:43:54 | FromDiscord | <pyolyokh> the point is, it's not some kind of danger mode reckless engagement with the variant. |
00:43:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfm |
00:44:07 | FromDiscord | <Elegantbeef> Sure there's runtime checks aswell |
00:44:08 | FromDiscord | <Elegantbeef> So it's not like a C union |
00:45:18 | FromDiscord | <MadScientistCarl> they can't have the same name... |
00:45:29 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lfo |
00:45:49 | FromDiscord | <pyolyokh> as does `a.b = "10"` in that line |
00:45:58 | FromDiscord | <Elegantbeef> Of course they cannot have the same name |
00:46:02 | FromDiscord | <Elegantbeef> Nim doesnt have pattern matching |
00:46:09 | FromDiscord | <pyolyokh> In reply to @MadScientistCarl "they can't have the": yep, variants have either shared fields or disjunct distinct fields. |
00:46:35 | FromDiscord | <pyolyokh> because in `MyVar(b: "10")` the fieldnames are the only way that Nim knows what variant you mean |
00:47:16 | FromDiscord | <Elegantbeef> Object variants are a tagged union like Rust's enums, but they're not similar implementations in the least |
00:47:39 | FromDiscord | <Elegantbeef> Nim's are closer to the bare layout |
00:48:03 | FromDiscord | <cow> they should allow fields to have the same name if they're the same type and at the same byte offset inside the object |
00:48:09 | FromDiscord | <pyolyokh> you can do the same stuff, you can't do it the same way. There are some plusses and minuses. Maybe you appreciate the explicit discriminant, maybe you wish you were writing OCaml |
00:48:42 | FromDiscord | <MadScientistCarl> Lol, if OCaml has a better C FFI I'd be using it |
00:48:46 | FromDiscord | <pyolyokh> In reply to @cow "they should allow fields": when that's the case for all variants, it's just a shared field |
00:48:56 | FromDiscord | <Elegantbeef> Rust's are a higher level abstraction that require having enforced pattern matching to function |
00:49:01 | FromDiscord | <cow> sometimes it's the case for 2 or 3, it's still annoying |
00:49:50 | FromDiscord | <Elegantbeef> It's a bit annoying cow, but atleast properties are 1 line of code and relatively simple |
00:50:05 | FromDiscord | <MadScientistCarl> Actually OCaml still doesn't have good multicore. I'd be writing Haskell instead. |
00:50:38 | FromDiscord | <pyolyokh> In reply to @MadScientistCarl "Lol, if OCaml has": I like OCaml but I worry that people aren't going to want to maintain OCaml, if I leave it when I leave a job. There have been some high-profile cases like that, and the language is clearly more esoteric even if it's no Haskell |
00:51:07 | FromDiscord | <ronaldinio> But not with Nim? |
00:51:22 | FromDiscord | <pyolyokh> not at all with Nim. |
00:51:34 | FromDiscord | <MadScientistCarl> I just wish Haskell's tooling is better. |
00:51:40 | FromDiscord | <cow> isn't nim more popular than ocaml |
00:51:43 | FromDiscord | <pyolyokh> "man I wish this were my favorite language", sure. "man this is Nim oh my god I refuse to touch it", no. |
00:52:18 | FromDiscord | <ronaldinio> Well thats the burden of ML |
00:53:46 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4lfr properties for unifying access of a field of the same name/type if anyone didnt know how |
00:53:49 | FromDiscord | <ronaldinio> You know if you write perl someone will maintain it |
00:54:23 | FromDiscord | <ronaldinio> %^} |
00:54:32 | FromDiscord | <MadScientistCarl> Well, you can always use F# |
00:54:59 | FromDiscord | <MadScientistCarl> I just don't like .Net because I never understand its package management system |
00:55:45 | FromDiscord | <<She>Horizon</Her>> Gradle took some time for me to understand in the jvm ecosystem, i refused to touch maven, and i have no idea how C# even works |
00:56:09 | FromDiscord | <cow> `dotnet add <package name>` and statically compile |
00:56:09 | FromDiscord | <Elegantbeef> I swear horizon |
00:56:13 | FromDiscord | <cow> forget about package trouble |
00:56:14 | FromDiscord | <Elegantbeef> Changing your name that much is a crime |
00:56:18 | FromDiscord | <ronaldinio> Gradle is annoying |
00:57:16 | FromDiscord | <ronaldinio> I saved an entire rewrite by changing IDE versions that support specific gradle versions etc etc |
00:57:32 | FromDiscord | <MadScientistCarl> When using `{.pure.}`, can I hide the top level definition? Otherwise what's the point of putting the enums under a namespace if it collides with top level anyways |
00:57:33 | FromDiscord | <Hourglass> Hah, Horizon just never felt like it fit me, and i grew out of Forest, sooo |
00:57:47 | FromDiscord | <Hourglass> In reply to @cow "`dotnet add <package name>`": Oh huh |
00:57:55 | FromDiscord | <Elegantbeef> Pure is no longer suggested |
00:58:10 | FromDiscord | <Hourglass> Yeah isn't it basically useless for non-compiler stuff? |
00:58:11 | FromDiscord | <cow> you can compile F# into a standalone binary with all dependencies included |
00:58:15 | FromDiscord | <Elegantbeef> It used to be a forced namespace but the semantics changed |
00:58:28 | FromDiscord | <Elegantbeef> And now it's pretty much "Hey this is only used if you have two enum fields that overlap" |
00:58:29 | FromDiscord | <cow> and I think dotnet installs dependencies locally in the project with `dotnet add` |
00:58:39 | FromDiscord | <Elegantbeef> Nim doesnt really do namespaces |
00:58:39 | FromDiscord | <Elegantbeef> It's like the antithesis to namespaces |
00:59:04 | FromDiscord | <MadScientistCarl> Well it collides with a type name |
00:59:19 | FromDiscord | <Elegantbeef> And with overloadableenums it's now further useless since we can have enums of the same name |
00:59:20 | FromDiscord | <pyolyokh> Then you have to change the name |
00:59:38 | FromDiscord | <MadScientistCarl> So `{.pure.}` is useless? |
00:59:43 | FromDiscord | <Elegantbeef> Yes |
01:00:02 | FromDiscord | <cow> the old idiomatic name way used to be prefixing with the abbreviation of the enum type iirc |
01:00:06 | FromDiscord | <Elegantbeef> Pure was changed into "Only if two enums clash are you required to use the Enum type" |
01:00:16 | FromDiscord | <Elegantbeef> Yep |
01:00:17 | FromDiscord | <pyolyokh> the stdlib is very old to excuse the design, but stuff like <https://nim-lang.org/docs/osproc.html> poEvalCommand, poThis, poThat, always works |
01:00:18 | FromDiscord | <cow> so a NodeKind enum would have elements like nkTerm, nkFactor, etc |
01:00:26 | FromDiscord | <Elegantbeef> An annoying Hungarian notation |
01:00:35 | FromDiscord | <pyolyokh> nah that's just C-style namespacing |
01:00:43 | FromDiscord | <cow> it's hungarian notation literally |
01:01:03 | FromDiscord | <pyolyokh> it might be technically hungarian notation but you're thinking beyond the namespace. Hungarian Notation can get a lot worse |
01:01:15 | FromDiscord | <cow> worse? who said it's bad |
01:01:24 | FromDiscord | <Elegantbeef> You could implement the enum in it's own module, and use it in your own model |
01:01:27 | FromDiscord | <Elegantbeef> moduel\ |
01:01:32 | FromDiscord | <cow> it's clearly not bad, otherwise people wouldn't be using it |
01:01:40 | FromDiscord | <pyolyokh> I feel like it being bad is nearly a universally held position ... |
01:01:50 | FromDiscord | <cow> annoying? sure, but it solves a problem |
01:01:59 | FromDiscord | <MadScientistCarl> OK... the current limitation already makes thing very hard to find in different modules |
01:02:10 | FromDiscord | <Elegantbeef> What? |
01:02:37 | FromDiscord | <MadScientistCarl> It's really hard to not put everything in a single giant source file with an equally big type block |
01:02:53 | FromDiscord | <Elegantbeef> Enums dont depend on anything |
01:02:57 | FromDiscord | <Elegantbeef> They surely can be seperated |
01:03:22 | FromDiscord | <cow> initially it took a bit for me to learn to deal with no cyclic imports |
01:03:28 | FromDiscord | <cow> i got better at it |
01:03:49 | FromDiscord | <MadScientistCarl> Then I have a file just for the enum, one giant file to hold the actual type that use this enum, and multiple other files that implement behavior |
01:04:13 | FromDiscord | <cow> you can compose multiple types into eachother |
01:04:15 | FromDiscord | <Elegantbeef> Then change the enum name and carry one |
01:04:16 | FromDiscord | <Elegantbeef> on |
01:04:25 | FromDiscord | <Elegantbeef> Alternatively share your code and we can give suggestions |
01:04:27 | FromDiscord | <pyolyokh> if you're wanting to do that to get namespacing, that won't help unless you static import the enum module |
01:04:51 | FromDiscord | <MadScientistCarl> Well... I am in the middle of a refactor so it might not be very sharable |
01:04:59 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lfu |
01:05:20 | FromDiscord | <MadScientistCarl> Ideally I would like `E.A` only, and no `A` |
01:05:22 | FromDiscord | <Elegantbeef> Sure but Nim's symbol rules means that a symbol inside this module is always selected first |
01:06:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfv |
01:06:35 | FromDiscord | <Elegantbeef> That wont compile due to having no `$` |
01:06:50 | FromDiscord | <Elegantbeef> Nim very much doesnt do namespaces intentionally |
01:06:55 | FromDiscord | <Elegantbeef> So what you're after is kinda against the grain |
01:08:20 | FromDiscord | <Elegantbeef> You could also use a macro do generate this https://github.com/beef331/micros/blob/master/tests/test1.nim#L129-L149 |
01:08:47 | FromDiscord | <T0lk1en> Hey if I have a parameter in a proc that is all caps. What does that mean? |
01:08:54 | FromDiscord | <Elegantbeef> It's all caps |
01:09:10 | FromDiscord | <sealmove> Hi, `StringStream(s)` errors with `invalid object conversion` (`s` is a Stream) which I find weird because I see this conversion used in `std`. What could be wrong? |
01:09:15 | FromDiscord | <cow> sent a code paste, see https://play.nim-lang.org/#ix=4lfw |
01:09:19 | FromDiscord | <cow> and the type name would be different |
01:09:38 | FromDiscord | <Elegantbeef> That defeats the purpose of enums↵(@cow) |
01:09:38 | FromDiscord | <pyolyokh> In reply to @รєคɭ๓๏שє "Hi, `StringStream(s)` errors with": you might not have the converters or whatever that std is using for them |
01:09:46 | FromDiscord | <Ayano> is "or" the bit or operator or am i missing something? |
01:10:00 | FromDiscord | <pyolyokh> In reply to @Ayano "is "or" the bit": "or" is also the bit operator |
01:10:24 | FromDiscord | <Elegantbeef> `StringStream(s)` is an invalid conversion if the object wasnt created as a `StringStream` |
01:10:24 | FromDiscord | <Elegantbeef> You cannot down cast only up cast |
01:10:59 | FromDiscord | <sealmove> In reply to @Elegantbeef "`StringStream(s)` is an invalid": oh |
01:11:05 | FromDiscord | <Elegantbeef> This does the same |
01:11:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfx |
01:11:11 | FromDiscord | <cow> In reply to @Ayano "is "or" the bit": it's the bit operator if it's operating on ints, it's boolean op if it's operating on booleans |
01:11:24 | FromDiscord | <Elegantbeef> It's one of the unfortunate choices of nim |
01:11:33 | FromDiscord | <Elegantbeef> it should be like `band` and `bor` or something akin |
01:11:37 | FromDiscord | <cow> why? |
01:11:48 | FromDiscord | <Elegantbeef> Cause it makes it hard to find order of operation issues |
01:11:48 | FromDiscord | <Ayano> In reply to @cow "it's the bit operator": when i or the two ints 249 and 128 together, it still gives me 249 |
01:12:19 | FromDiscord | <pyolyokh> yes, that's the correct result |
01:12:22 | FromDiscord | <Elegantbeef> You might not know binary operators |
01:12:27 | FromDiscord | <pyolyokh> were you wanting `and`? |
01:12:32 | FromDiscord | <Ayano> In reply to @pyolyokh "yes, that's the correct": nvm i am stupid |
01:12:36 | FromDiscord | <Elegantbeef> Bitwise or keeps all bits that are on |
01:12:42 | FromDiscord | <Elegantbeef> In either value |
01:12:49 | FromDiscord | <Elegantbeef> 128 and 246 both have the second last bit on |
01:13:03 | FromDiscord | <Elegantbeef> 249\ |
01:13:49 | FromDiscord | <cow> In reply to @Elegantbeef "Cause it makes it": fair |
01:14:21 | FromDiscord | <cow> or should have lower precedence than most other operators tho, right |
01:14:32 | FromDiscord | <MadScientistCarl> If I use `ref object` as key to tables, does its address get hashed or its content? |
01:16:35 | FromDiscord | <cow> what you get is hash not being defined |
01:17:02 | FromDiscord | <cow> source: just tried |
01:17:10 | FromDiscord | <sealmove> why is `readAll` blocking when my stream is being appended to constantly..... Shouldn't it read up until the moment of the call, find the end of Stream, and return? |
01:17:38 | FromDiscord | <cow> In reply to @cow "what you get is": so you need to define hash() for your type before you can use it as key |
01:20:27 | FromDiscord | <Elegantbeef> Or use `-nimPreviewHasRef` |
01:20:42 | FromDiscord | <Elegantbeef> > Important\: Use -d\:nimPreviewHashRef to enable hashing refs. It is expected that this behavior becomes the new default in upcoming versions. |
01:20:49 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lfA |
01:21:00 | FromDiscord | <Elegantbeef> It hashes the reference not value |
01:21:10 | FromDiscord | <Elegantbeef> Cause it should match `==` for the type |
01:21:15 | FromDiscord | <sealmove> In reply to @รєคɭ๓๏שє "why is `readAll` blocking": I don't see any blocking operation here https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/streams.nim#L261 It should break because of `readBytes == 0`... |
01:21:17 | FromDiscord | <Elegantbeef> And by default `==` is reference comparison of pointers |
01:23:01 | FromDiscord | <Elegantbeef> `readData` reads all that is there |
01:23:09 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lfC |
01:23:42 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/asyncfile.html is non blocking |
01:23:58 | FromDiscord | <pyolyokh> man 2 read: `On success, the number of bytes read is returned (zero indicates end of file),` |
01:24:00 | FromDiscord | <sealmove> and the only way to avoid blocking is to call `.atEnd` before reading every single byte? |
01:24:12 | FromDiscord | <Elegantbeef> Nope |
01:24:27 | FromDiscord | <Elegantbeef> `readChar` is also likely blocking |
01:24:47 | FromDiscord | <sealmove> yes I can avoid calling it if `.atEnd` returns true |
01:25:15 | FromDiscord | <Elegantbeef> You can also just use `asyncFile` |
01:25:53 | FromDiscord | <sealmove> I can't. I am using a Stream returned from `osproc` |
01:26:11 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/asyncfile.html#newAsyncFile%2CAsyncFD |
01:26:39 | FromDiscord | <MadScientistCarl> I start to feel like Nim is a supercharged Python |
01:26:46 | FromDiscord | <sealmove> it's not a file, it's the `errorStream` of a process |
01:26:47 | FromDiscord | <pyolyokh> the streams API isn't going to change how the underlying I/O works. If you're reading from a file or a socket and you don't want to block in 99% of cases, you need a selector or concurrency or something truly awful like your own manually polling with a sleep in it. ↵And that's still not 100% of cases. For 100% of cases you need actual threads. |
01:27:02 | FromDiscord | <Ayano> my uint with the value 5 shifted 7 to the left (shl 7) equals 128, why? |
01:27:04 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/osproc.html#errorHandle%2CProcess↵(@sealmove) |
01:27:14 | FromDiscord | <Elegantbeef> Wrap around shifting |
01:27:18 | FromDiscord | <Elegantbeef> It's UB |
01:27:25 | FromDiscord | <pyolyokh> because people will do something like use ceph for the filesystem and syscalls that never, ever block, start blocking when ceph is broken |
01:27:41 | FromDiscord | <Ayano> In reply to @Elegantbeef "Wrap around shifting": is there none warp around shifting |
01:28:03 | FromDiscord | <Ayano> and even if it wraps around my output has a zero less then my input |
01:28:07 | FromDiscord | <Hourglass> In reply to @MadScientistCarl "I start to feel": Iirc it's been said it wss more based on Pascal and OCaml |
01:28:30 | FromDiscord | <Hourglass> But i see your point, what made it easy for me to adjust to is that I'm a python programmer too |
01:28:59 | FromDiscord | <Hourglass> The biggest learning curve was lack of classes but objects and how procs work more than make up for it |
01:29:01 | FromDiscord | <jtv> Beef, if I've got a static vtable, and I want to use the function in a macro, is there a Lit() equiv, or am I best off just keeping the string around to generate the call? |
01:29:24 | FromDiscord | <Elegantbeef> `Lit()`? |
01:29:43 | FromDiscord | <MadScientistCarl> Well, the dispatch rules are more like Julia |
01:29:55 | FromDiscord | <jtv> sorry meant newLit() |
01:30:06 | FromDiscord | <Elegantbeef> I dont follow the question |
01:31:06 | FromDiscord | <jtv> I've got a function pointer statically in an array. I want to generate the code to dereference it from the function pointer, not from a string with the name |
01:32:02 | FromDiscord | <Elegantbeef> What's the issue with just `myArray[myId + myProcOffset](args)` through a `.()` macro |
01:32:36 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#special-operators-dot-operators |
01:33:10 | FromDiscord | <Elegantbeef> For traitor that's what i do to make a low cost access of the vtable |
01:34:21 | FromDiscord | <jtv> I'll check it out. I'm actually iterating through what is an array of tuples, and calling a proc to return a tree to generate some checks for each tuple. So I guess the question is really, if I've got this function pointer statically how do I get it as a nim node? |
01:34:22 | FromDiscord | <Elegantbeef> It's hard to say what to do given the little information i've got here |
01:36:42 | FromDiscord | <Elegantbeef> How do you store the data, in a macro cache? |
01:37:47 | FromDiscord | <jtv> No, I haven't actually dug into macro caches, been a while since I even ran across them, so didn't remember they existed. Just in a const array of tuples right now |
01:37:52 | * | ltriant quit (Ping timeout: 272 seconds) |
01:38:14 | FromDiscord | <Elegantbeef> So then it'd be `myConstArray.getInst` |
01:38:20 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lfH |
01:38:21 | FromDiscord | <Elegantbeef> Then you select the value you want |
01:38:32 | FromDiscord | <Elegantbeef> You can just make table a const there |
01:38:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfI |
01:39:03 | FromDiscord | <Elegantbeef> That statically folds in |
01:39:43 | FromDiscord | <Elegantbeef> If you look at the generated C it'll very likely just have `anonymousgenSym()` and `a = anonymousGensym` |
01:41:53 | FromDiscord | <jtv> Where is getInst declared? Not finding it in the docs |
01:42:08 | FromDiscord | <Elegantbeef> `std/macros` |
01:42:18 | FromDiscord | <Elegantbeef> Sorry `getImpl` |
01:42:58 | FromDiscord | <jtv> Ah, I'd been trying that earlier. Maybe I was doing something wrong then |
01:43:05 | FromDiscord | <jtv> Will try again |
01:43:28 | FromDiscord | <Elegantbeef> It's `getImpl` on your array that should return a const definition |
01:43:31 | FromDiscord | <Elegantbeef> You then can walk the tree to get what you want statically |
01:45:49 | FromDiscord | <jtv> Well, I was actually declaring the array as static: |
01:46:09 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4lfL |
01:46:37 | FromDiscord | <jtv> The second argument fptr, how to set that is my question |
01:46:52 | FromDiscord | <Elegantbeef> so then it'd be `newLit(x)` |
01:46:52 | FromDiscord | <Elegantbeef> It's still hard to say the best avenue |
01:47:42 | FromDiscord | <jtv> newLit(spec.fptr) should work?? I can obviously get it to work if I use a string and an ID node instead of trying to reference the function pointer |
01:48:17 | FromDiscord | <Elegantbeef> I'll be honest i'm very very uncertain what you're doing |
01:48:47 | FromDiscord | <jtv> It's fine, too hard to trim down to something small and not that important 🙂 |
01:48:48 | FromDiscord | <jtv> Thanks |
01:51:00 | FromDiscord | <Girvo> In reply to @mratsim "and if you need": Yooo that's huge: not for this use-case, but as a base for writing a DSL/inline assembler for the ESP32's ULP coprocessor haha |
01:52:00 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4lfO |
01:52:13 | FromDiscord | <auxym> cannot open (apparently an empty string) |
01:55:26 | FromDiscord | <that_dude> A bit of a weird question, but I need a data type that is 4 or less bytes big but acts like a float bit with higher precision(or a smaller size). I'm working with bouncing rays off of circles. Accuracy/correctness isn't as important as precision in my case. The angle stops changing when I go by increments of 1e-16. I think I would only need to cover a range of 0-1 or 0-6.28..., afaik |
01:57:19 | FromDiscord | <that_dude> Does something like this exist? |
02:01:03 | FromDiscord | <hector> In reply to @that_dude "Does something like this": No. 4 bytes = 32 bits. 2^32 ≈ 4.29 billion or 4.29e9. You can't store more values than that in such a small range |
02:02:20 | FromDiscord | <that_dude> true, but then why can I still work with precisions of e-14 and get it to work out? |
02:02:37 | FromDiscord | <sealmove> @ElegantBeef in tried your suggestion with asynFile. well... I get a Future but this doesn't really help me since I am not trying to delegate the reading of the stream. I just want to read whatever data is availiable at that moment and continue. |
02:04:34 | FromDiscord | <hector> In reply to @that_dude "true, but then why": Your question is way too vague and you haven't provided any actual code |
02:07:38 | FromDiscord | <MadScientistCarl> Is there something like `todo` that type checks everything? |
02:07:50 | FromDiscord | <Rika> In reply to @hector "Your question is way": I think his question made sense |
02:08:10 | FromDiscord | <Rika> Note he is currently using floats |
02:09:00 | FromDiscord | <that_dude> True, I'm more asking for a poc I'm taking a look at, It's not buggy I'm just wondering if I can get more information in the data type |
02:09:35 | FromDiscord | <that_dude> but if it helps, here's what I'm looking at https://media.discordapp.net/attachments/371759389889003532/1064003380894236672/image.png https://media.discordapp.net/attachments/371759389889003532/1064003381124931624/image.png https://media.discordapp.net/attachments/371759389889003532/1064003381330460702/image.png |
02:10:01 | FromDiscord | <Rika> There was this alternative data encoding called Posits that provide nicer precision but I never ended up finishing implementing it in Nim |
02:10:15 | FromDiscord | <that_dude> In the bottom pic it's recording what circles I'm hitting in the ring |
02:10:18 | FromDiscord | <Rika> And it would naturally also be much slower because lack of hardware support iirc |
02:10:20 | FromDiscord | <that_dude> (edit) "In the bottom pic it's recording what circles I'm hitting in the ring ... " added "in the first pic" |
02:10:43 | FromDiscord | <that_dude> In reply to @Rika "There was this alternative": I'm not to concerned with speed, I'll take a look at that, thanks |
02:10:54 | FromDiscord | <Elegantbeef> Just compile the code?↵(@MadScientistCarl) |
02:11:08 | FromDiscord | <MadScientistCarl> No, it's for developing |
02:11:16 | FromDiscord | <Rika> It’s prolly much harder to implement than you think so I don’t think it’s suitable for you |
02:11:26 | FromDiscord | <Elegantbeef> `{.warning: "unimplemented X".}` |
02:11:43 | FromDiscord | <MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4lfS |
02:11:49 | FromDiscord | <that_dude> I'll do string manipulations to do it if necessary lol |
02:11:52 | FromDiscord | <MadScientistCarl> Now the compiler is going to complain because `discard` doesn't have a type |
02:12:09 | FromDiscord | <MadScientistCarl> And the messages aren't helpful, because I haven't written the second `of` yet |
02:12:23 | FromDiscord | <Elegantbeef> there is no reversed inference |
02:12:29 | FromDiscord | <Elegantbeef> You just put a default value at the end |
02:12:35 | FromDiscord | <MadScientistCarl> (edit) "https://play.nim-lang.org/#ix=4lfS" => "https://play.nim-lang.org/#ix=4lfT" |
02:12:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfU |
02:12:57 | FromDiscord | <Elegantbeef> then it'd be like `todo(default(myType))` |
02:13:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfV |
02:13:37 | FromDiscord | <Elegantbeef> Then you could do `todo(MyType)` |
02:13:49 | FromDiscord | <Rika> IIRC you can even just pass result, and it’ll get the type from that |
02:14:11 | FromDiscord | <auxym> so... we can't exportC nim types, right? |
02:14:12 | FromDiscord | <Rika> For default I mean |
02:14:23 | FromDiscord | <Rika> In reply to @auxym "so... we can't exportC": ? I think you can |
02:14:27 | FromDiscord | <Elegantbeef> You can exportC nim types, but there isnt much point cause nim doesnt generrate a header |
02:14:40 | FromDiscord | <Elegantbeef> There iss a `--header` feature that has since been deprecated |
02:14:54 | FromDiscord | <auxym> can I exportc a nim enum to a C typedef enum? |
02:15:12 | FromDiscord | <auxym> I dont think I need a header |
02:15:29 | FromDiscord | <Elegantbeef> Like i said `exportC` doesnt do anything but give it a fixed name it doesnt generate a C style header |
02:16:39 | FromDiscord | <Rika> Huh I never thought of that, what are Nim enums compiled into |
02:16:58 | FromDiscord | <auxym> IIRC they |
02:17:10 | FromDiscord | <auxym> are compiled to some bare int |
02:17:19 | FromDiscord | <auxym> so answering my own question, no |
02:17:52 | FromDiscord | <Elegantbeef> They're the smallest sized int that makes sense |
02:18:29 | FromDiscord | <MadScientistCarl> How do I specify an iterator type? |
02:18:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lfW |
02:18:45 | FromDiscord | <Elegantbeef> `iterator(a: int): int` |
02:19:01 | FromDiscord | <MadScientistCarl> Can I use it in function arguments? |
02:19:13 | FromDiscord | <Elegantbeef> Yes but nim has 2 iterators |
02:19:17 | FromDiscord | <Elegantbeef> It has inline and closure |
02:19:24 | FromDiscord | <Elegantbeef> You cannot pass inline to procedures |
02:19:37 | FromDiscord | <MadScientistCarl> Can I pass something like `table.values` into functions? |
02:19:43 | FromDiscord | <Elegantbeef> Nope |
02:19:47 | FromDiscord | <Elegantbeef> Cause it's an inline iterator |
02:19:57 | FromDiscord | <Elegantbeef> You'd need like slicerator's `asClosure` |
02:19:59 | FromDiscord | <Elegantbeef> Or to use a template |
02:20:15 | FromDiscord | <Elegantbeef> It's a real shame |
02:22:38 | FromDiscord | <Elegantbeef> Or write your own closure generator |
02:23:24 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-firstminusclass-iterators this documents how a little down |
02:23:31 | FromDiscord | <Elegantbeef> `Closure iterators are resumable functions....` |
02:34:58 | FromDiscord | <MadScientistCarl> What's the best way to reference a sequence's last element? I am using `s[s.high]` now, but there is probablly a better one |
02:35:09 | FromDiscord | <Elegantbeef> `s[^1]` |
02:35:25 | FromDiscord | <MadScientistCarl> Is that a special index or something? |
02:36:02 | FromDiscord | <MadScientistCarl> Oh, it says backward index |
02:37:01 | FromDiscord | <Elegantbeef> `BackwardsIndex` is the type |
02:39:24 | FromDiscord | <Elegantbeef> Yep Nim's `[]` is all implemented in user space really |
02:39:47 | FromDiscord | <Elegantbeef> `a[b..c]` is just `[]` for `Slice[int]` `a[b..^c]` is a `HSlice[int, BackwardsIndex]` and so forth |
03:01:55 | FromDiscord | <MadScientistCarl> Does Nim have abstract classes, or "unimplemented" methods? |
03:02:33 | FromDiscord | <Elegantbeef> Nope |
03:05:28 | FromDiscord | <MadScientistCarl> Do I need to export inherited methods of derived classes? |
03:05:43 | FromDiscord | <Elegantbeef> Yes i think the type also needs to be exported |
03:06:36 | FromDiscord | <MadScientistCarl> Hmm, if derived class methods are private but base class ones are public, and I am not using the derived class directly, does it still work? |
03:06:52 | FromDiscord | <Elegantbeef> I dont recall |
03:06:57 | FromDiscord | <Elegantbeef> Give it a whirl is all i can say |
03:12:53 | FromDiscord | <Leftbones> Not sure where to ask this, but I can't find anything online about what it means to have a `` in a procedure definition, e.g. `proc foo(int: bar)` vs `proc foo(int: bar)` |
03:13:06 | FromDiscord | <Elegantbeef> It's an export marker |
03:13:14 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#procedures-export-marker |
03:13:20 | FromDiscord | <Leftbones> Excellent, thank you |
03:13:36 | FromDiscord | <Leftbones> It's hard to google symbols without associating words, and I wasn't sure what words to associate |
03:15:31 | FromDiscord | <nixfreak> Means it’s a public function↵(@Leftbones) |
03:15:55 | FromDiscord | <Leftbones> That's neat, I like that. |
03:16:09 | FromDiscord | <MadScientistCarl> Apparently, derived class functions don't need to be exported |
03:16:38 | FromDiscord | <Leftbones> I wasn't aware there were "class functions" since the classes are more like structs in C? |
03:16:57 | FromDiscord | <Elegantbeef> There are methods |
03:17:01 | FromDiscord | <Elegantbeef> But mad here is calling them classes |
03:17:26 | FromDiscord | <Elegantbeef> "Derived object methods" is the nim way of saying that 😛 |
03:18:10 | FromDiscord | <MadScientistCarl> Actually, you don't need to export them even if you are calling the method on a derived object directly |
03:18:13 | FromDiscord | <Leftbones> I'm used to calling them methods because of C# anyways lol |
03:18:48 | FromDiscord | <Leftbones> I'm just looking at this for now and so I assumed class methods weren't really a thing https://nim-by-example.github.io/types/objects/ |
03:18:59 | FromDiscord | <Leftbones> Any more of a thing than in C, that is |
03:19:06 | FromDiscord | <Elegantbeef> Well Nim doesnt have "classes" |
03:19:08 | FromDiscord | <Elegantbeef> So they're not a thing |
03:19:21 | FromDiscord | <MadScientistCarl> Not sure if that is a good idea, but I guess this way I control access by just exporting the base methods |
03:19:24 | FromDiscord | <Elegantbeef> There are a class of procedures called `method`s that use runtime information to dispatch |
03:19:39 | FromDiscord | <MadScientistCarl> I call them classes because they have inheritance... |
03:20:13 | FromDiscord | <Elegantbeef> I get why you do, i'm just saying that they're not classes since they dont behave anything like classes |
03:20:15 | FromDiscord | <Leftbones> In reply to @MadScientistCarl "I call them classes": I get what you mean now, I just got confused for a sec |
03:21:29 | FromDiscord | <Elegantbeef> Inheriting objects dont require declaring methods inside of a scope, there is no implcit `self` parameter, everything is free standing so it feels weird to me atleast to call them classes |
03:21:42 | FromDiscord | <Elegantbeef> Since it would give the painting that they behave like C++/C#/Python classes |
03:22:23 | FromDiscord | <MadScientistCarl> I guess Nim is closer to Common Lisp than C++, then |
03:22:24 | FromDiscord | <Elegantbeef> I'm just clearing up any ambiguity, not telling you what you can and cannot say |
03:22:38 | FromDiscord | <Elegantbeef> It's closer to pascal or oberon than C++ |
03:22:41 | FromDiscord | <MadScientistCarl> This just looks more like CLOS than something like C++ classes |
03:22:57 | FromDiscord | <Elegantbeef> Nim is quite literally a modern wirth language |
03:23:46 | FromDiscord | <Leftbones> I've only been writing nim for about... an hour, but I like it |
03:24:08 | FromDiscord | <Leftbones> Reminds me of C just without all the awful crap |
03:25:06 | FromDiscord | <Elegantbeef> Hey that |
03:25:10 | FromDiscord | <Elegantbeef> 's pretty much what pascal was |
03:25:31 | FromDiscord | <Leftbones> Lol I've never played around with pascal but I always liked how readable it was |
03:25:33 | FromDiscord | <Elegantbeef> A way of writing low level code without a type system that is as intelligent as a gnat |
03:27:09 | FromDiscord | <MadScientistCarl> Not sure if anyone have used Ada |
03:27:24 | FromDiscord | <Elegantbeef> I've not but i've looked at it quite a bit |
03:27:37 | FromDiscord | <MadScientistCarl> Last time I tried, it was extremely verbose to write |
03:28:18 | FromDiscord | <pyolyokh> it was physically painful to write without some editor extensions to save me from all the Words_Like_This |
03:28:20 | FromDiscord | <MadScientistCarl> Kind of feels like a 1990s Rust requiring twice as much code |
03:28:35 | FromDiscord | <pyolyokh> but apart from that it's a pretty nice language. |
03:28:39 | FromDiscord | <Elegantbeef> It's pretty much a very verbose wirth language 😄 |
03:29:04 | FromDiscord | <Elegantbeef> Though older pascal variants were quite verbose |
03:32:27 | FromDiscord | <Leftbones> I have tried and failed at Rust so many times simply because of how janky the syntax can be |
03:32:32 | FromDiscord | <Leftbones> Hard to read, harder to write |
03:33:12 | FromDiscord | <MadScientistCarl> Rust syntax is not great, but still very expressive |
03:33:32 | FromDiscord | <MadScientistCarl> The only thing I don't like about Rust is how big the `target` folder becomes. |
03:33:46 | FromDiscord | <Leftbones> I just can't wrap my head around it for some reason |
03:33:58 | FromDiscord | <MadScientistCarl> I just can't use it for small tools because of this. However, big projects are excellent. |
03:34:20 | FromDiscord | <MadScientistCarl> Plus, rust-analyzer is a very good LSP |
03:35:27 | FromDiscord | <Leftbones> I do love that |
03:35:29 | FromDiscord | <Leftbones> And clippy |
03:35:35 | FromDiscord | <Leftbones> Maybe someday I'll figure it out |
03:36:01 | FromDiscord | <Elegantbeef> Just write Nim |
03:37:12 | FromDiscord | <MadScientistCarl> Not sure how Nim works in big projects |
03:37:34 | FromDiscord | <Leftbones> If someone says Nim isn't ready for production, say "You're not the boss of me" and do it anyways |
03:37:36 | FromDiscord | <MadScientistCarl> Given the limitation of module import, I expect to have great trouble |
03:37:57 | FromDiscord | <Leftbones> In reply to @Leftbones "If someone says Nim": I stole/paraphrased this from something someone said about Zig, but it applies |
03:38:15 | FromDiscord | <MadScientistCarl> I just tried Zig today. The LSP crashes 5 times per second |
03:38:20 | FromDiscord | <Elegantbeef> it's not ideal since it lacks cyclical imports, but honestly cyclical imports are a bit ass |
03:38:22 | FromDiscord | <MadScientistCarl> I will put it on hold... |
03:38:42 | FromDiscord | <Leftbones> Zig is kinda neat, only reason I haven't messed with it much is I don't feel like getting into manual memory management again |
03:38:54 | FromDiscord | <MadScientistCarl> Well, if we are talking about Go and Rust's directory-based modules, then it is not a mess |
03:39:07 | FromDiscord | <Elegantbeef> Not saying i dont feel the need for them, but sometimes people just use cyclical imports it creates tedious to follow code |
03:39:43 | FromDiscord | <MadScientistCarl> My tricky part is that, the data follow a tree structure (nice), but behavior is like a graph |
03:39:52 | FromDiscord | <MadScientistCarl> So I have to dump every type into a single file |
03:40:31 | FromDiscord | <Elegantbeef> Well one could use `include` to seperate it |
03:40:37 | FromDiscord | <MadScientistCarl> Zig can use C/C++ directly, so I can use all the C/C++ packages floating out there |
03:40:42 | FromDiscord | <Elegantbeef> Not that i really condone `include` |
03:41:00 | FromDiscord | <Leftbones> Yeah Zig being able to drop in to C/C++ makes it easier to use in big projects right away for sure |
03:41:01 | FromDiscord | <MadScientistCarl> I don't feel right putting `include` in the middle of a file |
03:41:16 | FromDiscord | <Elegantbeef> Zig cannot use C++ directly |
03:41:16 | FromDiscord | <Elegantbeef> And i mean Nim has futhark so sorta ditto here |
03:41:18 | FromDiscord | <Leftbones> In reply to @MadScientistCarl "I don't feel right": Ugh, I hate when I see that |
03:41:37 | FromDiscord | <MadScientistCarl> I tried Zig, going straight into one of the project I use to evaluate a low level language: draw a triangle |
03:41:47 | FromDiscord | <MadScientistCarl> Then the moment I import a C header, the LSP crashes |
03:41:56 | FromDiscord | <Leftbones> Ope |
03:42:24 | FromDiscord | <MadScientistCarl> I haven't drawn a triangle in Nim yet. But I will definitely do so |
03:42:33 | FromDiscord | <Leftbones> 🔺 |
03:42:40 | FromDiscord | <MadScientistCarl> Nah, in Vulkan |
03:43:05 | FromDiscord | <Elegantbeef> What? |
03:43:27 | FromDiscord | <Elegantbeef> 'ope' is a response in the crash |
03:43:58 | FromDiscord | <Elegantbeef> Atleast i assume that's what they meant |
03:44:17 | FromDiscord | <pyolyokh> You missed some kind of discord only triangle image |
03:44:24 | FromDiscord | <Elegantbeef> No i got that |
03:44:33 | FromDiscord | <Elegantbeef> I dont get how that relates to anything 😄 |
03:44:51 | FromDiscord | <Elegantbeef> I'm going to shutup now |
03:45:02 | FromDiscord | <pyolyokh> I think, cheating by running `echo "unicode triangle"` ? |
03:45:03 | FromDiscord | <Leftbones> Oh idk, I was just responding to talking about drawing a triangle. |
03:45:14 | FromDiscord | <Leftbones> Without using words |
03:46:30 | FromDiscord | <MadScientistCarl> I hope Nim can do it |
03:46:37 | FromDiscord | <Elegantbeef> It certainly can |
03:46:45 | FromDiscord | <Elegantbeef> I've drawn a bit more than a triangle using opengl atleast |
03:46:55 | FromDiscord | <MadScientistCarl> There is one Vulkan binding, but I don't think it covers the complete spec |
03:47:02 | FromDiscord | <Leftbones> How robust is Nim for game dev? |
03:47:06 | FromDiscord | <Elegantbeef> https://streamable.com/csyb0s |
03:47:08 | FromDiscord | <Elegantbeef> I mean it works for me |
03:47:10 | FromDiscord | <MadScientistCarl> You can use Raylib |
03:47:20 | FromDiscord | <Leftbones> Been using Raylib for a long time, so that's good |
03:47:20 | FromDiscord | <MadScientistCarl> I tried the binding, and it is good |
03:47:26 | FromDiscord | <Leftbones> More recently Raylib-cs |
03:47:53 | FromDiscord | <Elegantbeef> That video is opengl + sdl2, not raylib |
03:48:01 | FromDiscord | <Leftbones> Even more impressive |
03:48:38 | FromDiscord | <MadScientistCarl> That's great |
03:49:00 | FromDiscord | <MadScientistCarl> Does Nim have a good ECS? |
03:49:06 | FromDiscord | <Elegantbeef> Polymorph |
03:49:51 | FromDiscord | <MadScientistCarl> Hmmm, Nim's extension's indentation choices are really weird |
03:52:13 | FromDiscord | <Leftbones> What's weird about them? |
03:53:12 | FromDiscord | <MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4lgc |
03:54:58 | FromDiscord | <Leftbones> Oh I haven't noticed anything like that (in vscode) |
03:57:08 | FromDiscord | <Elegantbeef> Nim pretty does a funny job formatting code |
04:00:46 | FromDiscord | <MadScientistCarl> Do nested function work the same as lambda? |
04:01:09 | FromDiscord | <MadScientistCarl> Except for the name part |
04:01:54 | FromDiscord | <Leftbones> I missed something earlier, what exactly about the import system makes Nim not ideal for large projects? |
04:02:47 | FromDiscord | <MadScientistCarl> Ordered declaration without forward declaration. This means if your types depend on each other, you need to put them all in the same block. |
04:03:07 | FromDiscord | <pyolyokh> In reply to @Leftbones "I missed something earlier,": there's no concrete advantage. You just can't organize modules across multiple files freely |
04:03:13 | FromDiscord | <MadScientistCarl> If your methods reference a whole bunch of types in a "graph" fashion, you pretty much have to put all types in the same file |
04:03:14 | FromDiscord | <pyolyokh> (edit) "advantage." => "disadvantage." |
04:03:18 | FromDiscord | <Leftbones> Ah |
04:12:45 | FromDiscord | <exelotl> In what language _can_ you have mutually dependent types in different files? |
04:13:02 | FromDiscord | <MadScientistCarl> Rust can |
04:13:11 | FromDiscord | <MadScientistCarl> Go also can, but that |
04:13:26 | FromDiscord | <MadScientistCarl> (edit) "that" => "that's because it treats directory as a package, not file" |
04:14:03 | FromDiscord | <MadScientistCarl> Even C can. You need to forward declare and use pointers, though |
04:14:27 | * | ltriant joined #nim |
04:15:48 | FromDiscord | <exelotl> Nim can do it the same as C it seems: https://nim-lang.org/docs/manual_experimental.html#package-level-objects |
04:16:07 | FromDiscord | <MadScientistCarl> That |
04:16:12 | FromDiscord | <MadScientistCarl> (edit) "That" => "That's experimental" |
04:18:27 | FromDiscord | <exelotl> Yes, but it's not gated behind a flag or anything, you can just use it. And in the future it will probably become a no-op because the language will have better support for circular imports |
04:19:59 | FromDiscord | <MadScientistCarl> That doesn't quite solve it |
04:20:00 | * | ltriant quit (Ping timeout: 272 seconds) |
04:20:05 | FromDiscord | <MadScientistCarl> Because the types are still incomplete |
04:22:10 | FromDiscord | <exelotl> You can also cheat pretty easily, just declare the troublesome field as a `pointer` and define an accessor that casts it to `ptr Foo` as soon as Foo is known |
04:23:59 | FromDiscord | <MadScientistCarl> That brings unsafe operations |
04:24:20 | FromDiscord | <MadScientistCarl> A huge source is annoying to edit, but bringing pointers might be more dangerous |
04:24:51 | FromDiscord | <T0lk1en> In reply to @MadScientistCarl "A huge source is": What is the use of manual mem management. |
04:24:58 | FromDiscord | <T0lk1en> I’m new |
04:25:10 | FromDiscord | <MadScientistCarl> Like, interfacing with C? |
04:25:15 | FromDiscord | <T0lk1en> Yeah |
04:25:34 | FromDiscord | <MadScientistCarl> Or if you need absolute performance, or if automatic mem management is not smart enough |
04:26:50 | FromDiscord | <T0lk1en> Gotcha |
04:28:14 | FromDiscord | <exelotl> In reply to @MadScientistCarl "That brings unsafe operations": If that's a concern you could abstract the pattern away behind a macro to make it safe again |
04:28:52 | FromDiscord | <MadScientistCarl> I haven't learned macros yet |
04:35:18 | FromDiscord | <exelotl> Hmm having mutually recursive ref types across module boundaries seems hard though, my idea still only works for pointers |
04:35:28 | FromDiscord | <huantian> In reply to @Elegantbeef "Nim pretty does a": beef when are we making a better nim formatter and linter |
04:35:47 | FromDiscord | <Elegantbeef> When i really care about code formatting |
04:36:35 | FromDiscord | <exelotl> I don't get why you'd need them though tbh, putting mutually recursive types in the same file seems like the correct approach |
04:37:38 | FromDiscord | <jtv> There are plenty of use cases in large systems where somewhat loosely related types end up having cycles, and not necessarily directly. |
04:38:04 | FromDiscord | <huantian> Why don’t you care about code formatting it’s super useful when people give you weirdly formatted code to fix! |
04:42:18 | FromDiscord | <Elegantbeef> Formatting isnt the top 10 things i need to fix |
04:44:19 | FromDiscord | <MadScientistCarl> How is `Option` types actually used? |
04:44:37 | FromDiscord | <MadScientistCarl> I looked at the example, there seem to be a `isSome` field but there isn't |
04:44:45 | FromDiscord | <jtv> It's a method |
04:45:17 | FromDiscord | <MadScientistCarl> OK... I forgot to import it |
04:46:21 | FromDiscord | <huantian> Mood |
04:46:49 | FromDiscord | <jtv> `https://play.nim-lang.org/#ix=4lgh |
04:47:01 | FromDiscord | <jtv> Oh you figured it out, good |
04:48:17 | FromDiscord | <MadScientistCarl> Thanks |
04:48:58 | FromDiscord | <MadScientistCarl> Huh, I can't assign a derived class object to a base field? |
04:49:34 | FromDiscord | <jtv> Sure you can, though you have to cast it to the base type I believe |
04:49:47 | FromDiscord | <Elegantbeef> You dont have to |
04:49:54 | FromDiscord | <Elegantbeef> `var parent: Parent = Child()` is valid |
04:50:05 | FromDiscord | <MadScientistCarl> I get invalid object assignment |
04:50:39 | FromDiscord | <Elegantbeef> Are you using `ref object of RootObj`? |
04:50:57 | FromDiscord | <MadScientistCarl> No, just `object of RootObj` |
04:51:28 | FromDiscord | <Elegantbeef> There's your issue |
04:51:34 | FromDiscord | <Elegantbeef> Stack based inheritance doesnt allow that |
04:51:44 | FromDiscord | <Elegantbeef> You should almost always do `ref object of` |
04:52:54 | FromDiscord | <MadScientistCarl> I guess I can also have a final object with proc fields.. |
04:53:34 | FromDiscord | <MadScientistCarl> Then I never worry about ref's implications |
05:06:02 | * | azimut quit (Ping timeout: 255 seconds) |
05:07:41 | * | mikess joined #nim |
05:12:59 | * | mikess quit (Quit: leaving) |
05:15:31 | FromDiscord | <Leftbones> Anyone have ideas on how I could force illwill to let me use true color ansi escape codes? |
05:16:45 | FromDiscord | <Elegantbeef> Aside from forking it to add it, you could just quote everything you're outputting with true colour possibly |
05:18:35 | FromDiscord | <Leftbones> illwill's `write` procedure doesn't seem to want to parse the escape codes properly, depending on how I do it, I either get no change, or it prints the code as a string |
05:19:16 | FromDiscord | <Elegantbeef> Ah then seems you need to fork to add true colour support |
05:19:19 | FromDiscord | <Leftbones> I saw that std/terminal supports true color now but can't quite understand how to use it |
05:19:46 | FromDiscord | <Leftbones> illwill and terminal both use the same system for colors so I think if I could figure that out I could shoehorn it in there |
05:22:53 | FromDiscord | <Elegantbeef> Terminal doesnt support it afaik |
05:23:12 | FromDiscord | <Leftbones> Idk I found this https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/colors.nim |
05:23:16 | FromDiscord | <Elegantbeef> It just has features to enable/disable it |
05:23:28 | FromDiscord | <Leftbones> A lot more colors in there, at least. |
05:23:53 | FromDiscord | <Elegantbeef> oh yea https://nim-lang.org/docs/terminal.html#ansiForegroundColorCode%2CColor |
05:24:11 | FromDiscord | <Leftbones> Yeah I found that, haven't figured out how to use it though |
05:24:22 | FromDiscord | <Leftbones> Oh wait |
05:24:40 | FromDiscord | <Leftbones> AHA |
05:24:50 | FromDiscord | <Elegantbeef> `ansiForeGroundColorCode(colAqua) & myStr & ansiResetCode` |
05:24:52 | FromDiscord | <Leftbones> Okay, gotta pass in the color from `colors` INTO that |
05:24:55 | FromDiscord | <Leftbones> Yep, that did it |
05:27:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lgo |
05:27:40 | FromDiscord | <Leftbones> No such thing! |
05:34:02 | * | arkurious quit (Quit: Leaving) |
05:36:04 | FromDiscord | <Leftbones> Seems to be working, partially at least. Printing in some areas is instead giving me a large black box. It's a start though. |
05:40:08 | FromDiscord | <Leftbones> Example, first image is without calling `truecolor` at all, second is calling it just on the "Normal" text (which is printed separately from "0:0") https://media.discordapp.net/attachments/371759389889003532/1064056370506256445/image.png https://media.discordapp.net/attachments/371759389889003532/1064056370799845446/image.png |
05:40:46 | FromDiscord | <Leftbones> That might have to do with the order in which I am printing things, since I didn't put too much thought into it. I'll have to tinker a bit. |
05:41:56 | FromDiscord | <Elegantbeef> Yet another TUI text editor? 😄 |
05:42:05 | FromDiscord | <Leftbones> Lol it's my go-to for when I'm tinkering with a new language |
05:42:35 | FromDiscord | <Leftbones> And yes, because there STILL isn't a perfect one! 😆 |
05:43:30 | FromDiscord | <Rika> still, assuming there ever will be |
05:43:46 | FromDiscord | <Leftbones> It'll only happen if people keep trying I suppose |
05:43:56 | FromDiscord | <Leftbones> Helix is close, perhaps as close as we've been so far |
05:48:07 | FromDiscord | <Makoren> software is never perfect |
05:48:10 | FromDiscord | <Makoren> there's always something |
05:48:19 | FromDiscord | <Leftbones> Yeah it's an oxymoron for sure |
05:48:38 | FromDiscord | <Leftbones> But I like making text editors :MarioShrug: |
07:23:14 | FromDiscord | <ShalokShalom> In reply to @MadScientistCarl "There is one Vulkan": There is also a binding to Unreal 5↵https://github.com/jmgomez/NimForUE |
07:23:58 | FromDiscord | <ShalokShalom> Godot 3 used to be supported, we will see if anybody does one for 4↵↵Does that count as Vulkan binding? 😀 |
07:40:22 | * | ltriant joined #nim |
07:48:23 | * | ltriant quit (Ping timeout: 268 seconds) |
08:19:06 | * | tiorock joined #nim |
08:19:06 | * | tiorock quit (Changing host) |
08:19:06 | * | tiorock joined #nim |
08:19:06 | * | rockcavera quit (Killed (copper.libera.chat (Nickname regained by services))) |
08:19:06 | * | tiorock is now known as rockcavera |
08:37:13 | FromDiscord | <Phil> So normal nim code is code that transforms via established ways of transforming expressions into standard nim node patterns that later get further compiled.↵So you have 2 elements: 1) Nim Code - 2) Standard Nim node pattern↵Macros are ways to transform non-standard nim code into those standard nim-node patterns.↵Are there valid nim node patterns that are impossible to build with normal nim code, that you can only build with macros and |
08:37:37 | FromDiscord | <Phil> (edit) removed "of transforming expressions" |
08:38:37 | FromDiscord | <Rika> gensym |
08:39:07 | FromDiscord | <Phil> Could you elaborate? I'm not sure what you mean by that |
08:39:52 | FromDiscord | <Rika> You can’t make symbols that look like gensym symbols outside of metaprogramming |
08:40:03 | FromDiscord | <Rika> Contains singular ` iirc |
08:45:18 | FromDiscord | <Phil> Huh, interesting |
08:45:23 | FromDiscord | <Elegantbeef> you can just do `var a {.gensym.} = 300` |
08:45:33 | FromDiscord | <Elegantbeef> Macros are generally only capable of what you can manually write |
08:45:40 | FromDiscord | <Elegantbeef> They just allow you to abstract that away |
08:46:02 | FromDiscord | <Elegantbeef> there are some things they can do like "access a private procedure from another module" |
08:46:22 | FromDiscord | <Elegantbeef> But to do that you have to pass them the private procedure in some way |
08:46:43 | FromDiscord | <Rika> In reply to @Elegantbeef "you can just do": Really, never seen that construct before |
08:47:52 | FromDiscord | <Elegantbeef> > fatal error\: error writing to /tmp/ccPHFJbH.s\: No space left on device↵> Uh oh playground needs to clear caches |
08:48:01 | FromDiscord | <Elegantbeef> oh it doesnt seem to work variables, might only work inside a template |
08:48:36 | FromDiscord | <untoreh> is there a way to pass build flags for each dependency in nimble file? |
08:49:10 | FromDiscord | <Elegantbeef> No |
08:49:19 | FromDiscord | <Elegantbeef> That doesnt make much sense |
08:50:15 | FromDiscord | <Elegantbeef> Yea seems like the gensym pragma only works inside a template on a procedure |
08:50:51 | FromDiscord | <Phil> In reply to @Elegantbeef "That doesnt make much": It does when 2 packages rely on the same `define` flag and you really only want one effect |
08:51:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lh8 |
08:51:27 | FromDiscord | <Elegantbeef> What\\ |
08:52:28 | FromDiscord | <Elegantbeef> "I want to build this package with -d\:ssl, but this one without" doesnt seem to be sensible to me |
08:52:48 | FromDiscord | <Elegantbeef> Or "I want to build this package with --mm\:arc and this one with --mm\:refc" |
08:52:55 | FromDiscord | <untoreh> I guess il just fork the package then |
08:53:01 | FromDiscord | <untoreh> fork everything! |
08:53:05 | FromDiscord | <Phil> More along the lines of "I want to build this packge with -d:takeShortcuts but this other package without" |
08:53:22 | FromDiscord | <Phil> And for some backass reason they both took the same custom `takeShortcuts` name |
08:54:15 | FromDiscord | <Elegantbeef> Well that's a issue + PR to fix it in a future version |
08:54:29 | FromDiscord | <Phil> Basically when different people use the same flag name for different things |
08:54:51 | FromDiscord | <Phil> Yeh, imo namespacing those may be a requirement |
08:55:19 | FromDiscord | <Elegantbeef> I think there is a whole `--define:a.b` feature in nim2.0 |
08:55:20 | FromDiscord | <Phil> Like how norm specifies that enabling/disabling logging inside of it can be compiled in/out with `-d:normDebug` |
08:55:23 | FromDiscord | <Elegantbeef> Or it might be an RFC |
08:55:56 | FromDiscord | <Elegantbeef> But yes, if a define is ambiguous, it needs to be fixed |
08:56:36 | FromDiscord | <untoreh> there are packages that when installed build some cli tools can it be disabled? |
08:56:40 | FromDiscord | <Elegantbeef> Plus Nim doesnt really have libraries, it sorta does but yea |
08:57:55 | FromDiscord | <untoreh> you can do `nimble install -d` but, when you are inside a project and do `nimble build/run` it still builds them |
08:58:18 | FromDiscord | <Phil> I don't understand, you want to compile your project without compiling your dependencies in? |
08:58:32 | FromDiscord | <Elegantbeef> I dont follow either |
08:58:34 | FromDiscord | <untoreh> some dependencies build some cli tools that are not needed |
08:59:09 | FromDiscord | <Phil> That's a PR to the depdendency, asking them to provide a flag to enable/disable that CLI tool... is this nimibook? |
08:59:40 | FromDiscord | <untoreh> no leveldb |
09:00:21 | FromDiscord | <Elegantbeef> What's even the issue with building it? |
09:01:02 | FromDiscord | <Phil> Eats compile time I'd imagine, not sure how much but if you don't need to use it and have to pay the compilation-time over and over I'd imagine it gets annoying |
09:01:04 | FromDiscord | <Elegantbeef> If you're actively testing your code by running `nimble run` you're already in a place of sadness as even without any of that shit it's slow as helll |
09:01:36 | FromDiscord | <Elegantbeef> `nim c -r ./src/bleh.nim` is much quicker than calling a nimble task to build your code |
09:01:59 | FromDiscord | <Elegantbeef> Atleast in my experience i just use nim directly |
09:02:04 | FromDiscord | <untoreh> it builds a leveldbtool, but I have the library build locally, but I can't pass the path when it builds the clitool, so it fails since it looks in the system path |
09:02:17 | FromDiscord | <untoreh> I guess I just have to disable that |
09:02:26 | FromDiscord | <Phil> It is faster, to me nimble tasks were more reproducible when transferring code between machines because it installs the dependencies for you |
09:02:29 | * | kenran joined #nim |
09:02:33 | FromDiscord | <Elegantbeef> Yea then make a PR to add a define i guess |
09:02:44 | FromDiscord | <Phil> And the time difference isn't that huge when you're already waiting 30-40s either way |
09:02:52 | FromDiscord | <Elegantbeef> Phil i'm not saying dont use `nimble test` and `nimble run` to test the code |
09:03:07 | FromDiscord | <Elegantbeef> Why the fuck are you waiting 30-40s?! |
09:03:08 | * | kenran quit (Remote host closed the connection) |
09:03:10 | FromDiscord | <Elegantbeef> My game compiles in 3s |
09:03:14 | FromDiscord | <Phil> (edit) "It" => "Not using nimble tasks" |
09:03:36 | FromDiscord | <Phil> Fucktons of generics I assume |
09:04:30 | FromDiscord | <Elegantbeef> Yea a rebuild of the nim compiler isnt even 30-40s here in most cases |
09:04:44 | FromDiscord | <Elegantbeef> So you want me to look at your project 😛 |
09:05:08 | FromDiscord | <Phil> Its webdev and I don't use acronym, you'll run away screaming 😛 |
09:05:27 | FromDiscord | <Phil> Anyway, I need to upgrade it to work with nim 2.0, doesn't compile under 1.9.1 |
09:06:16 | FromDiscord | <Elegantbeef> I'm just amazed that your project takes so long to compile, how many loc is it? |
09:06:37 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lhd |
09:06:58 | FromDiscord | <Elegantbeef> for pre 2.0, yes |
09:07:08 | FromDiscord | <Phil> I want to compile under 1.9.1 |
09:07:20 | FromDiscord | <Elegantbeef> well with 2.0 `addr` is the same as `unsafeaddr` |
09:07:25 | FromDiscord | <Phil> Well, have to, I make use of various lib fixes that aren't available on 1.6.10 |
09:08:00 | FromDiscord | <Phil> Okay, in that case I'm confused.↵The output [0].addr line explodes with:↵`Error: expression has no address; maybe use 'unsafeAddr` |
09:08:32 | FromDiscord | <Phil> This is a part of my code where I actually do not fully understand how it works, so I'm not really sure how to fix it |
09:09:06 | FromDiscord | <Elegantbeef> Yea on 2.0 that's the same, so uhh regression |
09:09:21 | FromDiscord | <Elegantbeef> Commit? |
09:09:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lhg |
09:09:48 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lhh |
09:09:49 | FromDiscord | <Phil> Wait... that's not right |
09:09:50 | FromDiscord | <Phil> one sec |
09:10:01 | FromDiscord | <Elegantbeef> Lol |
09:10:02 | FromDiscord | <Elegantbeef> Well there's your problem |
09:10:12 | FromDiscord | <Phil> God damn I was on 1.6.10 for a brief stint to write examples for sb |
09:10:25 | FromDiscord | <Phil> Ohhhh right now I remember |
09:10:53 | * | jjido joined #nim |
09:10:54 | FromDiscord | <Phil> I use my own database pool and that one still relies on db_sqlite and the like to be available as per the usual |
09:11:19 | FromDiscord | <Phil> I'd swap to norms but norm has the same issue due to one of its dependencies |
09:13:46 | FromDiscord | <Elegantbeef> What's your projects public repo again? |
09:15:06 | * | krux02 joined #nim |
09:25:41 | FromDiscord | <Phil> Which one? The connection pool one?↵Tinypool↵The one with 11k loc that currently doesn't compile because tinypool isn't compatible with the changes made to db_sqlite and consorts?↵Nimstoryfont |
09:25:59 | FromDiscord | <Elegantbeef> The latter |
09:29:54 | FromDiscord | <Elegantbeef> Hmm with the mass usage of `implDefaults` I probably should help you by making that simpler |
09:30:24 | FromDiscord | <Elegantbeef> Doing less work on the VM with the same result would help quite a bit |
09:30:53 | FromDiscord | <Phil> Yeah I basically have fundamentally like...~25 tables or so |
09:31:02 | FromDiscord | <Phil> And I define for every one of those at least 3-5 models |
09:31:11 | FromDiscord | <Phil> All of which get implDefaults |
09:31:45 | FromDiscord | <Elegantbeef> Yea I think there might be some things I can optimise |
09:39:36 | * | rockcavera quit (Remote host closed the connection) |
09:42:36 | FromDiscord | <Phil> Though I'd repeat, given how heavily I leverage the compiler to generate dozens of modules worth of code for me via generics, I wouldn't be surprised if that's the issue |
09:44:02 | FromDiscord | <Elegantbeef> I mean generics are faster than parsing/semantically checking multiple manual versions |
09:44:07 | FromDiscord | <Elegantbeef> Atleast in theory |
09:46:05 | FromDiscord | <Phil> Yeh but this is on quite a scale.↵Like, I have ~25 tables/"mini-applications".↵I'm generating at roughly 100 loc's worth for at least half of them.↵The only thing that isn't heavily generic-infested is my de-serialization |
09:46:22 | FromDiscord | <Phil> (edit) removed "at" | "100" => "100+" |
09:46:33 | FromDiscord | <Phil> (edit) "de-serialization" => "serialization" |
09:48:09 | FromDiscord | <Elegantbeef> Hey i'm just doing my part |
09:48:18 | FromDiscord | <Phil> Actually let me correct that, I'm generatic at least 200loc worth of code, I'm scratching above 150loc just based on the controllers alone |
09:48:19 | FromDiscord | <Elegantbeef> I had some stupid code in constructor that didnt make any sense anywho |
09:48:34 | FromDiscord | <Phil> Alrighty, I mean I won't complain about free speed ups 😛 |
09:48:47 | FromDiscord | <Phil> (edit) "generatic" => "generating" |
09:49:02 | FromDiscord | <Elegantbeef> `1.1.1` is out now |
09:49:51 | FromDiscord | <Phil> I'll upgrade to it once I can actually compile my project again |
09:51:11 | FromDiscord | <Elegantbeef> Yea doubt it'll help much but i was iterating all the fields twice making a collection, then adding those, so it was a shit load of useless work |
09:51:25 | FromDiscord | <Elegantbeef> Think i accidently pushed part of a feature i was intending |
10:10:23 | FromDiscord | <Phil> Curse me, I really need to set up a proper pipeline for tinypool in order to test postgres docker containers |
10:11:13 | FromDiscord | <qb> I'm wrapping a c function which iterates over the system processes. It uses a callback and I'm wondering how I could avoid the global `processList` sequence. How would someone use that function in c? https://play.nim-lang.org/#ix=4lhA |
10:44:52 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
10:51:58 | FromDiscord | <pyolyokh> `arg: lm_void_t` is probably there to give you something other than a global to modify |
10:52:38 | FromDiscord | <pyolyokh> you'd just need to cast it to/from a `ptr seq[lm_process_t]` or similar |
11:04:07 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lhS |
11:31:24 | * | ltriant joined #nim |
11:36:44 | * | ltriant quit (Ping timeout: 260 seconds) |
11:47:48 | * | ltriant joined #nim |
11:53:17 | * | krux02 quit (Remote host closed the connection) |
11:59:23 | * | jjido joined #nim |
12:07:12 | FromDiscord | <lignus> sent a code paste, see https://play.nim-lang.org/#ix=4li5 |
12:09:32 | FromDiscord | <pyolyokh> <https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L1874> |
12:11:24 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
12:32:47 | FromDiscord | <planetis> In reply to @lignus "I find myself writing": why exactly? are you using case objects, distincts or refs? |
12:33:20 | FromDiscord | <planetis> there are a few that work for case objects, patty comes to mind but also newer ones. |
12:37:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lia |
12:38:15 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lib |
13:01:03 | FromDiscord | <qb> sent a code paste, see https://play.nim-lang.org/#ix=4lii |
13:08:16 | FromDiscord | <pyolyokh> sent a long message, see http://ix.io/4lim |
13:08:24 | FromDiscord | <pyolyokh> Nim procs by default have a different calling convention |
13:26:03 | FromDiscord | <qb> No luck yet. Just looked into the the rust wrapper. Seems like it's the same like we do on nim now. https://github.com/rdbo/libmem/blob/master/libmem-rs/src/lib.rs#L358 |
13:26:21 | FromDiscord | <MadScientistCarl> Is it possible to change the `.Type` behavior of a distinct type? |
13:26:34 | FromDiscord | <MadScientistCarl> Like a custom constructor or something |
13:30:59 | FromDiscord | <turbo> sent a code paste, see https://play.nim-lang.org/#ix=4lit |
14:17:17 | * | ltriant quit (Read error: Connection reset by peer) |
14:19:38 | FromDiscord | <turbo> sent a code paste, see https://paste.rs/8tY |
14:22:32 | * | ltriant joined #nim |
14:34:08 | FromDiscord | <Dimi> sent a long message, see http://ix.io/4lkD |
14:37:40 | FromDiscord | <hotdog> In reply to @Dimi "Dear All, I": Try using tryRecv or peek instead of recv |
14:38:54 | FromDiscord | <Dimi> In reply to @hotdog "Try using tryRecv or": Oh thanks a lot. That's a good one indeed and I was definitely skipped that somehow |
14:39:13 | FromDiscord | <hotdog> No prob 🙂 |
14:42:57 | * | azimut joined #nim |
14:51:29 | FromDiscord | <voidwalker> About the subject of reading the last line or last N bytes from a stream, without blocking. Is there any particular reason why the current length of the stream is not available in the Stream type? Otherwise, how would one attempt to achieve this, in a stream that is continuously being written to ? (errorstream of a process) ? |
14:54:33 | FromDiscord | <MadScientistCarl> Is there a constant for "max value"? |
14:54:37 | FromDiscord | <MadScientistCarl> Like max value of float |
14:59:38 | FromDiscord | <hotdog> In reply to @MadScientistCarl "Is there a constant": For ints yes it’s high(int) (or high(int32) etc) |
14:59:43 | FromDiscord | <hotdog> Floats no |
14:59:55 | FromDiscord | <MadScientistCarl> I can use `Inf` for floats, |
14:59:55 | FromDiscord | <hotdog> As they go up to +inf |
14:59:59 | FromDiscord | <hotdog> Yeah |
15:00:42 | FromDiscord | <hotdog> In reply to @voidwalker "About the subject of": What’s the usecase? |
15:01:17 | FromDiscord | <voidwalker> @hotdog trying to parse some data the ffmpeg output, which gets continually written to the stream |
15:01:23 | FromDiscord | <MadScientistCarl> Are there any machine learning packages in Nim? Even basic ones are good |
15:01:27 | FromDiscord | <voidwalker> (edit) "@hotdog trying to parse some data ... the" added "from" |
15:04:22 | FromDiscord | <voidwalker> https://nimble.directory/search?query=machine+learning -> https://github.com/can-lehmann/exprgrad |
15:04:28 | FromDiscord | <ambient> In reply to @MadScientistCarl "Are there any machine": https://github.com/mratsim/Arraymancer |
15:04:58 | FromDiscord | <voidwalker> (edit) "https://nimble.directory/search?query=machine+learning -> https://github.com/can-lehmann/exprgrad ... " added "+ https://github.com/mratsim/Arraymancer" |
15:05:39 | FromDiscord | <MadScientistCarl> Thank you |
15:08:09 | FromDiscord | <hotdog> In reply to @voidwalker "<@472459996068839424> trying to parse": Could you read the available data (if any) on each loop and add to a buffer you process separately when there is enough info? |
15:08:19 | FromDiscord | <hotdog> Or use peekLine or similar |
15:08:57 | FromDiscord | <hotdog> When you say “length of the stream” do you mean the amount of buffered-but-unread data? |
15:09:02 | FromDiscord | <voidwalker> yes |
15:10:31 | FromDiscord | <hotdog> Gotcha |
15:10:41 | FromDiscord | <voidwalker> Thing is, I don't want to continually read this stream and update the value i am looking for, I would need a thread for that, or async. I just want to read to the "end" of the stream, on demand, to get the "latest" value |
15:11:01 | * | arkurious joined #nim |
15:11:17 | FromDiscord | <hotdog> Why would you need a thread or async? |
15:11:39 | FromDiscord | <voidwalker> how else would you continually read from that stream without bloicking the main program then ? |
15:13:00 | FromDiscord | <hotdog> In reply to @voidwalker "how else would you": Read until there is no remaining data buffered then continue your main loop |
15:13:31 | FromDiscord | <voidwalker> @hotdog readAll blocks for some reason, until the stream is actually finished (process ends) |
15:14:09 | FromDiscord | <hotdog> In reply to @voidwalker "<@472459996068839424> readAll blocks for": Don’t use readAll |
15:14:36 | FromDiscord | <hotdog> Simplest would be to just read char by char until peek throws an ioerror |
15:14:56 | FromDiscord | <voidwalker> that would be terribly slow, stream could be a few megabytes |
15:15:14 | FromDiscord | <hotdog> There’s maybe a more optimal way of doing it but I can’t check right now |
15:15:31 | FromDiscord | <MadScientistCarl> How do I deal with `include` making the editor lint everything as error? |
15:15:33 | FromDiscord | <hotdog> You could also peekLine and do it line by line |
15:16:26 | FromDiscord | <voidwalker> I was thinking of doing setPos in a binary search manner, in a try except block, until I find approximately the last value ? that sounds kind of retarded though |
15:16:27 | FromDiscord | <hotdog> In reply to @MadScientistCarl "How do I deal": Which editor? You should be able to set a main entry point project file which should help |
15:16:39 | FromDiscord | <MadScientistCarl> VSCode. |
15:18:55 | FromDiscord | <hotdog> In reply to @MadScientistCarl "VSCode.": With nimsaem plug-in? |
15:19:02 | FromDiscord | <MadScientistCarl> I think so |
15:19:09 | FromDiscord | <MadScientistCarl> Ah, I think it is again declaration order |
15:19:30 | FromDiscord | <MadScientistCarl> Looks like I still have to make things modules instead of including |
15:19:35 | FromDiscord | <hotdog> In reply to @voidwalker "I was thinking of": That sounds messy. How long is the final value you need to read? Or do you just need to know the stream has ended? |
15:20:01 | FromDiscord | <hotdog> In reply to @MadScientistCarl "Looks like I still": Yeah I’d always avoid include if possible anyway |
15:20:06 | FromDiscord | <voidwalker> the value is a float, that I need to parse from a line in the stream. |
15:20:14 | FromDiscord | <MadScientistCarl> But then I can't control visibility |
15:20:19 | FromDiscord | <MadScientistCarl> Because I have to make everything public |
15:20:32 | FromDiscord | <voidwalker> (edit) "stream." => "stream (latest line, or very close to it)" |
15:21:01 | FromDiscord | <hotdog> In reply to @MadScientistCarl "Because I have to": Keep all the private stuff in a private subfolder, export your main api from top level module |
15:21:08 | FromDiscord | <hotdog> Is quite common |
15:21:27 | FromDiscord | <MadScientistCarl> But there are public types, and their fields have to be all public |
15:21:46 | FromDiscord | <MadScientistCarl> Otherwise I can't implement anything unless I put everything in one giant file |
15:21:56 | FromDiscord | <hotdog> In reply to @voidwalker "the value is a": I’d just read line by line then personally and keep a buffer of the last X lines |
15:22:01 | FromDiscord | <pyolyokh> you should really, really, really just put everything in one giant file. |
15:22:22 | FromDiscord | <MadScientistCarl> That is not going to be maintainable |
15:22:51 | FromDiscord | <pyolyokh> there's no difference to maintainability. You find large files unpleasant for some reason. Maybe slow tooling? |
15:23:32 | FromDiscord | <MadScientistCarl> It's just a pain to edit. If you have one giant file, you can look at two parts of it side by side, and that's it |
15:24:38 | FromDiscord | <pyolyokh> sure, it's a pain somehow. What it looks to me is that you're trying to trade away problems that you can easily anticipate, from large files, for much more severe problems that you're gradually become more aware of. |
15:24:52 | FromDiscord | <voidwalker> In reply to @hotdog "I’d just read line": but how do you know if you reached the "end", where the most up to date value we are searching for is ? |
15:25:10 | FromDiscord | <hotdog> In reply to @voidwalker "but how do you": Stream.atEnd() |
15:25:42 | FromDiscord | <cow> In reply to @pyolyokh "you should really, really,": not really |
15:26:02 | FromDiscord | <cow> I don't like big files either |
15:26:21 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4lkV |
15:26:22 | FromDiscord | <voidwalker> never exits the loops |
15:26:25 | FromDiscord | <voidwalker> (edit) "loops" => "loop" |
15:27:49 | FromDiscord | <cow> In reply to @MadScientistCarl "But then I can't": there's an alternative pattern where for every type, you create a file with all the procs that operate on the type, make all members private, and you use your own API in the rest of the code |
15:28:27 | * | xet7 quit (Remote host closed the connection) |
15:28:42 | FromDiscord | <MadScientistCarl> OK, now that sounds a lot like a header file |
15:28:48 | FromDiscord | <cow> not really |
15:28:54 | FromDiscord | <cow> it sounds like OOP |
15:29:09 | FromDiscord | <cow> you put the type and all related behavior in a single file |
15:29:11 | FromDiscord | <hotdog> In reply to @voidwalker "never exits the loop": Hmm |
15:29:22 | FromDiscord | <MadScientistCarl> But if you can't put behavior in the module, it's like a header defining types only |
15:29:47 | FromDiscord | <cow> yeah you had some recursive import problems right |
15:29:54 | FromDiscord | <MadScientistCarl> I have to put behavior in a separate module, because it references multiple types. And that causes problems due to circular imports |
15:30:12 | FromDiscord | <cow> are you sure you can't break up behavior into multiple functions and compose them later |
15:30:21 | FromDiscord | <MadScientistCarl> I already tried very hard |
15:30:30 | FromDiscord | <cow> what problem area is this |
15:30:37 | FromDiscord | <cow> it's hard to give advice generally |
15:30:46 | FromDiscord | <MadScientistCarl> It's kind of a turn based game simulator |
15:30:54 | FromDiscord | <cow> and you have a massive type for game state? |
15:31:05 | FromDiscord | <MadScientistCarl> Pretty much all state types can interact with all other state types |
15:31:21 | FromDiscord | <MadScientistCarl> So most state would have at least some function that reference every other type of state |
15:31:28 | FromDiscord | <Saint> Is there a way for the nim compiler to only autocomplete to .nim files? |
15:31:36 | FromDiscord | <Saint> Like how cd only autocompletes to directories |
15:31:42 | FromDiscord | <MadScientistCarl> Right now I am putting all the behavior in separate modules. But that makes the type fields exposed |
15:31:43 | FromDiscord | <Saint> In zsh or bash etc |
15:31:50 | FromDiscord | <pyolyokh> In reply to @Saint "Is there a way": that's shell configuration, not something nim is doing |
15:32:02 | FromDiscord | <cow> idk, you could also leave the type fields exposed and add documentation instructing not to manipulate them |
15:32:11 | FromDiscord | <cow> some languages don't have private fields (like Dart iirc) |
15:32:13 | FromDiscord | <Saint> In reply to @pyolyokh "that's shell configuration, not": Yeah I figured but I was wondering if anyone here knows how to do it |
15:32:17 | FromDiscord | <MadScientistCarl> Yeah, that is fine, but not ideal |
15:33:44 | FromDiscord | <MadScientistCarl> I guess I can put all the accessors in the types module |
15:34:33 | FromDiscord | <MadScientistCarl> Actually no, because setters will have to be exported too |
15:34:47 | FromDiscord | <pyolyokh> In reply to @Saint "Yeah I figured but": something like `complete -f -X '!.nim' nim` for bash |
15:35:02 | FromDiscord | <Saint> Ooh gotcha thanks @pyolyokh |
15:35:16 | FromDiscord | <cow> another idea @MadScientistCarl |
15:35:36 | FromDiscord | <pyolyokh> In reply to @Saint "Ooh gotcha thanks <@803214225002463283>": biggest problem with that is that it doesn't complete directories |
15:36:10 | FromDiscord | <cow> sent a code paste, see https://play.nim-lang.org/#ix=4ll0 |
15:36:15 | FromDiscord | <pyolyokh> `complete -f -o plusdirs -X '!.nim' nim` works better |
15:36:30 | FromDiscord | <cow> you could create a public type that has a private member for the type you want, and explicitly create the API that way |
15:36:46 | FromDiscord | <MadScientistCarl> I guess that will work |
15:37:07 | FromDiscord | <cow> (edit) "https://play.nim-lang.org/#ix=4ll0" => "https://play.nim-lang.org/#ix=4ll3" |
15:37:35 | FromDiscord | <cow> maybe it'll work with type PublicType = BigType too, not sure, I rarely use new names for old types |
15:37:54 | FromDiscord | <hotdog> @voidwalker https://play.nim-lang.org/#ix=4ll4 |
15:38:04 | FromDiscord | <hotdog> This works as expected, echoing the lines then exiting |
15:38:27 | FromDiscord | <hotdog> So perhaps there is something else going on in your code? |
15:38:46 | FromDiscord | <voidwalker> yah but not the same thing as a real process with continuous output ? |
15:39:41 | FromDiscord | <voidwalker> also, `errs.getPosition` -> `Error: unhandled exception: cannot retrieve file position [IOError]` |
15:39:57 | FromDiscord | <hotdog> I don't really understand your problem then |
15:40:20 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4ll6 |
15:40:30 | FromDiscord | <voidwalker> but I can't get position :\ |
15:41:08 | FromDiscord | <hotdog> In reply to @voidwalker "I was thinking to": Why? |
15:41:29 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4ll7 |
15:41:38 | FromDiscord | <hotdog> If you just want to throw away a character, just do `discard stream.readchar` |
15:41:40 | FromDiscord | <voidwalker> so that instead of bloccking forever on readlines I get a crash if I try to set position beyond the stream length |
15:42:03 | FromDiscord | <hotdog> In reply to @voidwalker "so that instead of": Use peekline |
15:42:04 | FromDiscord | <voidwalker> to cause it to break out of the loop (= we are at "end") |
15:42:06 | FromDiscord | <hotdog> Like I said before |
15:42:22 | FromDiscord | <voidwalker> you sure peekLine is not blocking ? |
15:43:07 | FromDiscord | <hotdog> Perhaps it does, I don't remember |
15:43:44 | FromDiscord | <hotdog> Or just read into a buffer and create your own non-blocking version, reading char by char until there is nothing to read, as I said before |
15:44:25 | FromDiscord | <voidwalker> If only I could convert the Stream into a StringStream, but I can't |
15:45:02 | FromDiscord | <voidwalker> I believe reading char by char would be slow enough to be considered "blocking", even if it would work |
15:45:39 | FromDiscord | <hotdog> In reply to @voidwalker "I believe reading char": I wouldn't discount it, it's what readline does anyway..... https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/streams.nim#L1009 |
15:46:12 | FromDiscord | <voidwalker> hm indeed.. |
15:47:59 | FromDiscord | <voidwalker> but why can't I get the position of the errorStream ? |
15:49:32 | FromDiscord | <hotdog> Because there's no position implementation |
15:49:58 | FromDiscord | <Nerve> Question, what's the equivalent of Pythons `if name == "main":`? I'd like to prototype and test my project's modules using only that module's source, and conditionally not compiling that testing code when it isn't the main source file seems cleaner and more useful than commenting or uncommenting the bottom of the file. |
15:50:04 | FromDiscord | <Nerve> (edit) "Pythons" => "Python's" |
15:50:10 | FromDiscord | <hotdog> In reply to @Nerve "Question, what's the equivalent": when isMainModule: |
15:50:23 | FromDiscord | <Nerve> Thank you very much |
15:51:36 | FromDiscord | <voidwalker> @hotdog what is this then ? https://nim-lang.org/docs/streams.html#getPosition%2CStream |
15:52:06 | FromDiscord | <hotdog> Look at the source |
15:52:09 | FromDiscord | <hotdog> It calls `getPositionImpl` |
15:52:55 | FromDiscord | <hotdog> Which needs to be created for getposition to work |
15:57:29 | FromDiscord | <MadScientistCarl> For `Table`, is there a method for "update if has key"? |
15:58:30 | FromDiscord | <pyolyokh> no, only for the opposite logic of "update if hasn't key" |
16:02:14 | FromDiscord | <pyolyokh> without forking it and using rawGet, I think the closest you can get is using <https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/collections/tables.nim#L340> and catching the exception |
16:03:34 | FromDiscord | <Saint> I'm getting an error saying SSL not supported, but I'm including the -d:ssl flag |
16:03:34 | FromDiscord | <Saint> https://hastebin.com/nigutopuxe.yaml |
16:03:47 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix= |
16:03:58 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix= |
16:04:08 | FromDiscord | <Saint> Any idea what is going on? |
16:04:24 | FromDiscord | <Saint> I'm guessing it's something to do with my dynamically linking the library |
16:04:48 | FromDiscord | <Saint> I'm using the hot code reloading prototype feature of jester/nimja I guess |
16:05:29 | FromDiscord | <Saint> nimja's really I guess |
16:05:49 | FromDiscord | <pyolyokh> those errors definitely only fire in non-defined(ssl) paths. I imagine your hot code reloading isn't using -d:ssl in the recompile. |
16:06:26 | FromDiscord | <scipio> sent a code paste, see https://paste.rs/khO |
16:06:50 | FromDiscord | <enthus1ast> it could be that the dll that is build, does not have ssl enabled.@Saint |
16:07:01 | FromDiscord | <Saint> Hmm right |
16:07:51 | FromDiscord | <enthus1ast> it might be enough to add a .nims file with↵↵switch("define", "ssl") |
16:07:56 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lld |
16:08:19 | FromDiscord | <enthus1ast> @Saint\: it must be named as the dll that is generated |
16:09:02 | FromDiscord | <Saint> I was able to get it somehow working adding the flag inside nimjas hotloading code |
16:09:16 | FromDiscord | <enthus1ast> yes thats another option |
16:09:17 | FromDiscord | <Saint> Idk if I would have to submit a pull request but theres still soemthing not working |
16:09:18 | FromDiscord | <Saint> Didn't crash though |
16:09:51 | FromDiscord | <enthus1ast> what else is not working? |
16:13:43 | FromDiscord | <enthus1ast> but yes, the compile command should be configurable. |
16:28:04 | * | jjido joined #nim |
16:33:16 | FromDiscord | <Saint> ethus1ast: My previous issue was that I was having multiple instances of my webserver running at the same time |
16:33:23 | FromDiscord | <Saint> I wouldn't get a warning that something was already listening on that port |
16:33:30 | FromDiscord | <Saint> Maybe there has to be a fix for it or something |
16:34:05 | FromDiscord | <Saint> But secondly now I'm getting some error which I assume is related to an async proc, anything I need to do to call an async proc from a non async proc other than waitFor and including std/asyncdispatch? |
16:34:33 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix=4lll |
16:36:02 | FromDiscord | <enthus1ast> yeah there could be a lot of reasons |
16:36:29 | FromDiscord | <enthus1ast> maybe try to compile with --gc\:orc then it might crash more accurately |
16:37:10 | FromDiscord | <Saint> I'll try that |
16:37:53 | FromDiscord | <enthus1ast> ah and also, when you do the hot code reloading, i would compile the host application and the dll with the same flags |
16:38:07 | FromDiscord | <enthus1ast> so, release/debug and the same memory management |
16:38:26 | FromDiscord | <enthus1ast> i noticed some issues when they're not the same |
16:39:49 | FromDiscord | <Saint> --gc:orc always crashes my server regardless |
16:40:02 | FromDiscord | <Saint> In reply to @enthus1ast "so, release/debug and the": SUre makes sense |
16:41:28 | FromDiscord | <Saint> Without --gc:orc and running my server with my async web call, this is the error that I get |
16:41:36 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix=4llo |
16:41:50 | FromDiscord | <Saint> If I run the same async function from just a regular nim file it works |
16:42:33 | FromDiscord | <Saint> Or actually maybe it doesn't hmm one sec |
16:42:49 | FromDiscord | <enthus1ast> mh |
16:43:50 | FromDiscord | <enthus1ast> does it always crash, or does it sometimes work? |
16:46:22 | FromDiscord | <enthus1ast> have a look this thread looks like the issue you have\: https://forum.nim-lang.org/t/3055 |
16:46:23 | FromDiscord | <Saint> Always crasehs |
16:46:52 | FromDiscord | <pyryrin> sent a code paste, see https://play.nim-lang.org/#ix=4llr |
16:47:06 | FromDiscord | <enthus1ast> but this is stuff i do not know very well, maybe someone else have more clue |
16:47:48 | FromDiscord | <pyolyokh> In reply to @pyryrin "why isn't it printing": it knows it's a `ptr Vec3f64` so it prints the more helpful thing instead of a random number. |
16:48:04 | FromDiscord | <pyryrin> how do i get it to print an address |
16:48:12 | FromDiscord | <pyolyokh> `cast[int](a.unsafeAddr)` |
16:48:30 | FromDiscord | <pyryrin> thanks |
16:50:08 | FromDiscord | <cow> @pyryrin you can also `cast[pointer](a.unsafeAddr)` if you want 0xHEX_HERE represenation |
16:53:37 | FromDiscord | <pyryrin> sent a code paste, see https://play.nim-lang.org/#ix=4llt |
16:55:33 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4llu |
16:57:00 | FromDiscord | <pyryrin> i dont really want to use a tuple |
17:00:54 | FromDiscord | <Saint> enthus1ast: At least I can confirm that this is an issue with the hot reloading code, cause when I do it without it, it works |
17:18:19 | FromDiscord | <enthus1ast> @Saint\: do you do a async call in the dll? |
17:19:35 | FromDiscord | <Saint> Yeah |
17:19:39 | FromDiscord | <Saint> I do |
17:19:54 | FromDiscord | <Saint> Also any idea why I'm getting this "No uri scheme supplied." for encodeUrl |
17:20:02 | FromDiscord | <Saint> In a test file it works fine without any 'scheme' |
17:20:25 | FromDiscord | <Saint> I think its httpclient messing with it |
17:22:27 | FromDiscord | <sealmove> question about jester / async... suppose one of the routes has blocking code (let's say we have a `sleep(1000)`). Does the whole server blocks for 1 second? What happens when a new request comes in during this 1 second? |
17:24:07 | FromDiscord | <enthus1ast> @Saint\: i can reproduce it with orc |
17:24:27 | FromDiscord | <enthus1ast> yeah thats unfortunate |
17:26:33 | FromDiscord | <Saint> In reply to @enthus1ast "<@890692135827959919>\: i can reproduce": Reproduce what exactly? |
17:26:44 | FromDiscord | <Saint> That async doesn't work in a hot reload dll? |
17:27:07 | FromDiscord | <enthus1ast> i can crash it when i use orc |
17:27:13 | FromDiscord | <enthus1ast> but works with refc |
17:28:49 | FromDiscord | <Rika> In reply to @รєคɭ๓๏שє "question about jester /": blocks |
17:29:06 | FromDiscord | <Saint> In reply to @enthus1ast "but works with refc": Oh i see |
17:29:08 | FromDiscord | <Rika> request prolly dropped within the second, or queued (by socket buffer?) until it resumes perhaps |
17:29:09 | FromDiscord | <Saint> What does that mean hmm |
17:29:14 | FromDiscord | <Saint> 🤔 |
17:29:34 | FromDiscord | <Saint> I figure that I'll leave out hcr since it's experimental anyways right |
17:29:38 | FromDiscord | <Saint> Thats what nimja says |
17:33:38 | FromDiscord | <enthus1ast> @Saint\: it seems to work with\: -d\:useMalloc --gc\:orc |
17:33:48 | FromDiscord | <enthus1ast> for both, the dll and the host |
17:33:56 | FromDiscord | <enthus1ast> yes |
17:34:00 | FromDiscord | <enthus1ast> its experimental |
17:35:24 | FromDiscord | <Saint> Hmm okay |
17:35:32 | FromDiscord | <Saint> I'll try that out next ethus1ast! |
17:35:38 | FromDiscord | <Saint> You're using IRC right? |
17:35:49 | FromDiscord | <enthus1ast> nope matrix |
17:35:51 | FromDiscord | <Saint> Too bad there's no autocmplete for irc usernames on Discord |
17:35:52 | FromDiscord | <Saint> Ohh |
17:36:13 | FromDiscord | <Saint> How do you get to mention my name? |
17:36:29 | FromDiscord | <Saint> @enthus1ast Does this work for higlighting? |
17:36:36 | FromDiscord | <enthus1ast> yes |
17:44:14 | FromDiscord | <Saint> Cool |
17:44:42 | FromDiscord | <Saint> Say I want to check if certain fields exist in my object (json object) and if it throws an exception I want to catch it |
17:45:17 | FromDiscord | <Saint> Whats a way for me to do like a no-op check of it? I wanted to to something like if (obj["key1"]["key2"]["key3"]: continue |
17:45:21 | FromDiscord | <Saint> And put a try catch around that |
17:45:26 | FromDiscord | <Saint> Is there a better way? |
17:58:36 | FromDiscord | <Phil> In reply to @Saint "Whats a way for": I'm only skimming into here, but do you basically want to iterate over a type and check "do you have a field of name X" ? |
17:59:31 | FromDiscord | <Phil> Because that's pretty easily doable, that's where you want to use compile time procs |
17:59:36 | FromDiscord | <Saint> In reply to @Isofruit "I'm only skimming into": Well more like I just want to do some sort of access and catch the exception |
17:59:37 | FromDiscord | <Phil> and the fieldpairs iterator |
18:00:07 | FromDiscord | <Phil> Ohhh wait, I just now read it's a json object |
18:00:27 | FromDiscord | <Phil> Does this use std/json? or does it use some custom lib? |
18:00:55 | FromDiscord | <Phil> Either way, there will be a "hasKey" proc or something equivalent. std/json has it for sure, I'd be surprised if any lib was missing it that deals with json |
18:04:57 | FromDiscord | <Saint> In reply to @Isofruit "Either way, there will": Yeah I know I can do haskey or something but for example i'd have to do multiple haskeys if I'm trying to access an object 5 layers deep |
18:05:14 | FromDiscord | <Phil> Ah and you want a comboversion? |
18:05:20 | FromDiscord | <Saint> And I'm wondering more just for general information what's a way of doing some sort of no-op executition |
18:05:38 | FromDiscord | <Saint> In python I can do if (foo['a']['b']['c']): continue |
18:05:48 | FromDiscord | <Saint> (edit) "In python I can do if (foo['a']['b']['c']): continue" => "sent a code paste, see https://play.nim-lang.org/#ix=4llW" |
18:05:58 | FromDiscord | <Saint> And then throw a try except around it |
18:06:02 | FromDiscord | <Saint> I was wondering what the equivalent would be in nim |
18:06:13 | FromDiscord | <Phil> At a glance I can't think of anything immediately.↵The route I typically go to is json-string --> nim object type immediately, I very rarely deal with a json-intermediate object type explicitly because it is annoying |
18:08:56 | FromDiscord | <Phil> And imo just the parsing into an object thing would be easier and faster to deal with in general |
18:09:22 | FromDiscord | <Phil> But then again I don't know what's forcing you to deal with JsonObject |
18:11:41 | * | xet7 joined #nim |
18:18:30 | FromDiscord | <Rika> Python pass equivalent is discard in Nim |
18:18:34 | FromDiscord | <voidwalker> does anyone know if `atEnd` ran on the errorStream of a process would never return true, if the process is a .sh file that has the commands to execute ? Or what else coud cause it |
18:19:56 | FromDiscord | <voidwalker> that way the actual thing to run is under a parent process |
18:21:07 | FromDiscord | <voidwalker> Was needed to run as .sh because it seems nim does not support running something with pipes?, like `ffmpeg -i "$1" -f yuv4mpegpipe -strict -1 - | av-scenechange -` |
18:25:57 | FromDiscord | <huantian> @Saint what if you use https://nim-lang.org/docs/json.html#overview-handling-optional-keys |
18:26:12 | FromDiscord | <huantian> With that one nil chaining thing in std |
18:27:21 | FromDiscord | <huantian> https://nim-lang.org/docs/wrapnils.html |
18:29:27 | FromDiscord | <Saint> In reply to @Rika "Python pass equivalent is": Thanks |
18:29:57 | FromDiscord | <Saint> In reply to @huantian "<@890692135827959919> what if you": Looks interesting too |
18:30:06 | FromDiscord | <Saint> Can any variable be nil in nim? |
18:31:01 | FromDiscord | <huantian> Only refs can be nil |
18:31:11 | FromDiscord | <Saint> Right |
18:36:14 | FromDiscord | <Phil> Self answered SO question from me incomiiiiiiiiing, feel free to ignore it |
18:39:02 | FromDiscord | <Phil> Man, that bot used to be a fair bit faster |
18:47:06 | FromDiscord | <enthus1ast> but you can use `options` https://nim-lang.org/docs/options.html↵(@Saint) |
18:47:20 | FromDiscord | <enthus1ast> and futures also work a little like options |
18:52:58 | * | xet7 quit (Remote host closed the connection) |
18:54:38 | FromDiscord | <Saint> Gotcha, thanks! |
18:55:32 | FromDiscord | <pyryrin> is there any convention to when to use something as a method or an ordinary function |
18:55:44 | FromDiscord | <pyryrin> (edit) "use" => "call" |
18:58:17 | FromDiscord | <enthus1ast> @pyryrin\: this is relevant https://nim-lang.org/docs/tut2.html#object-oriented-programming-dynamic-dispatch |
18:59:42 | FromDiscord | <pyryrin> yeah but sometimes you wanna call procs like methods too |
19:00:12 | FromDiscord | <cow> In reply to @pyryrin "is there any convention": it' |
19:00:20 | FromDiscord | <pyryrin> like `seq.filter(...).map(...)` instead of `filter(map(...), ...)` |
19:00:33 | FromDiscord | <cow> (edit) "it'" => "use procs when you compile time know the type, use method when you need runtime type resolution" |
19:00:43 | FromDiscord | <cow> In reply to @pyryrin "like `seq.filter(...).map(...)` instead of": oh between these it's just aesthetics really |
19:00:54 | FromDiscord | <enthus1ast> oh this, this is syntactic sugar, you can decide what is more logical to you |
19:01:42 | FromDiscord | <pyryrin> i know but i just really wish there was a convention for it |
19:02:14 | FromDiscord | <cow> it's like naming conventions, everyone has their own |
19:02:37 | FromDiscord | <pyryrin> but there is a naming convention to nim |
19:03:08 | FromDiscord | <cow> I use the method call syntax almost always |
19:04:18 | FromDiscord | <cow> In reply to @pyryrin "but there is a": oh i guess there is |
19:25:37 | FromDiscord | <Phil> I am reasonably certain that the bot informing about SO questions is broken at this point |
19:25:53 | FromDiscord | <T0lk1en> Hey guys I’m using the os module to get Params. Is there anyway to make it to where if no param is given then no error is thrown |
19:26:24 | FromDiscord | <Phil> Okay, one sec, that's quite a sentence to parse |
19:27:26 | FromDiscord | <Phil> I assume this is for linux? |
19:28:20 | * | rockcavera joined #nim |
19:28:23 | FromDiscord | <T0lk1en> Windows actually |
19:28:32 | FromDiscord | <T0lk1en> Linux machine broke rn |
19:28:52 | FromDiscord | <Phil> In that case I'ma use the simple way, why not throw the error yourself if the `paramCount` proc returns 0? |
19:29:21 | FromDiscord | <Phil> Or wait, other way around, you get an error without params and want to avoid it? |
19:29:21 | FromDiscord | <T0lk1en> So sum like try:↵Except return 0 |
19:29:38 | FromDiscord | <T0lk1en> Yeah when no params are given I get an error |
19:29:58 | FromDiscord | <T0lk1en> I’m trying to get to where if params are given to use those but if none are then use some default values |
19:30:16 | FromDiscord | <T0lk1en> I think you solved it tho with the try |
19:30:55 | FromDiscord | <Phil> Ah, you mean you haven't tried a try-except block yet? |
19:31:05 | FromDiscord | <Phil> Then yeah, that's your go to |
19:31:24 | FromDiscord | <T0lk1en> Nah. It didn’t come to mind. The more I learn the more I find try blocks useful |
19:31:32 | FromDiscord | <T0lk1en> Especially when getting user input |
19:32:08 | FromDiscord | <Phil> Try-catch blocks keep making me want to have a result block |
19:32:13 | FromDiscord | <Phil> (edit) "block" => "type" |
19:32:39 | FromDiscord | <Phil> And there are kind of ways to do it in nim, but I'm not a massive fan of the solutions I've seen, doesn't feel as effortless |
19:33:04 | FromDiscord | <T0lk1en> What’s result type? |
19:34:06 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix=4lml |
19:34:07 | FromDiscord | <Phil> So you know how any piece of code in nim (and the majority of other languages) throw an Exception/Error if something bad occurs, like you trying to access a field on object that's nil |
19:34:29 | FromDiscord | <Phil> Actually forget the nil thing, more like receiving a json string that doesn't match to the type it should parse to |
19:34:35 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix=4lmm |
19:35:52 | FromDiscord | <Phil> In those scenarios I would prefer it if the proc `parseJson(jsonString)` didn't return either the parsed JSON or throw an exception.↵I would prefer it if it returned a Result-type in both scenarios.↵Result is kind of like an optional, it expresses that this value may contain the desired parsed output, but it can also contain one of several errors |
19:36:38 | FromDiscord | <Phil> And if you want to get the actual value out of the Result type, you need to also deal with what should happen if the Result is not the actual outcome you want, but with the error that may have occurred while doing the parsing |
19:37:00 | FromDiscord | <Phil> While with Exceptions, nothing inside of the code forces you to deal with them |
19:37:10 | FromDiscord | <Phil> You can just not do a try-except block and still use it all fine |
19:38:09 | FromDiscord | <Phil> In that way Result types are "annoying" to deal with because they force you to deal with the errors that may occur |
19:38:35 | FromDiscord | <Phil> But they're also great because they force you to deal with everything that can occur, no hidden exception blowing up somewhere, it's all explicit |
19:39:25 | FromDiscord | <huantian> Why not just wrap the proc that may return an exception with a result version then |
19:39:56 | FromDiscord | <Phil> It's not that it's impossible or anything in nim, the multiple result-implementations confirm that it can be done |
19:40:51 | FromDiscord | <Phil> It's just that they're either not as convenient as I'd want, or don't support providing one "Success" with multiple different possible "Failure" types that would contain the actual error itself that was thrown |
19:41:43 | FromDiscord | <Phil> Say what you want about Rust, I have a ton of gripes about the language, but focus on pattern matching and their Result-type implementation were really good ideas |
19:43:43 | FromDiscord | <huantian> I think I find results only useful when I want to handle the error↵Most of the time i just use results as weird exceptions in rust |
19:52:06 | FromDiscord | <MadScientistCarl> How do I debug a Nim program? it just exits on exception without dropping into the debugger |
20:16:14 | FromDiscord | <MadScientistCarl> Actually, does LLDB even work with Nim? |
20:30:28 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
20:36:02 | FromDiscord | <T0lk1en> Hey guys how do append a file in nim. I have a variable that changes and I want to simply append a file. Not overwrite it |
20:43:02 | FromDiscord | <Kermithos> In reply to @T0lk1en "Hey guys how do": https://nim-lang.org/docs/io.html#FileMode↵you need fmAppend |
20:46:55 | FromDiscord | <Kermithos> In reply to @MadScientistCarl "Actually, does LLDB even": look into the "debugging" section of the vscode extension ↵https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode |
20:47:33 | * | azimut_ joined #nim |
20:47:53 | * | azimut quit (Ping timeout: 255 seconds) |
20:49:22 | FromDiscord | <MadScientistCarl> It doesn't work. Breakpoints have no effect |
20:51:25 | FromDiscord | <T0lk1en> In reply to @Kermithos "https://nim-lang.org/docs/io.html#FileMode you need": Could you give an example. I’m having trouble |
20:54:26 | FromDiscord | <T0lk1en> Nvm I think I got it |
21:04:11 | FromDiscord | <Gumbercules> In reply to @MadScientistCarl "It doesn't work. Breakpoints": Yes it does... So does gdb |
21:04:28 | FromDiscord | <Gumbercules> You need to compile with debug stmbols |
21:04:52 | FromDiscord | <MadScientistCarl> I think I did |
21:05:02 | FromDiscord | <MadScientistCarl> I have d:debug and debug:native |
21:07:11 | FromDiscord | <amadan> iirc the flag is `--debugger:native` not `--debug:native` |
21:08:27 | FromDiscord | <MadScientistCarl> I have this in `config.nims`: |
21:08:35 | FromDiscord | <MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4lmK |
21:08:38 | FromDiscord | <MadScientistCarl> No effect |
21:11:42 | FromDiscord | <MadScientistCarl> I changed to use nims.cfg, with no effect either |
21:12:31 | FromDiscord | <Phil> PMunch (or whoever else, I don't actually know who keeps an eye on it):↵I'm pretty sure nimeventer is dead, or at the very least has stopped reporting stuff from SO.↵Was that intentional? |
21:16:08 | FromDiscord | <MadScientistCarl> I can't get debugging to work |
21:16:34 | FromDiscord | <MadScientistCarl> I tried specifying the option through cmdline, but it has no effect either |
21:16:57 | FromDiscord | <sealmove> does `osproc` support callback for when the process finishes? |
21:17:36 | FromDiscord | <MadScientistCarl> OK, specifying directly through command line works. However, I can't get the compile options to persist, no matter what config file I edit |
21:30:28 | FromDiscord | <Nerve> So I just found out about the `nim secret` RCPL, is this a planned feature with a roadmap that needs time to finalize or is it just a curiosity? What's the progress on it? |
21:37:40 | FromDiscord | <Phil> In reply to @Nerve "So I just found": nim secret is what's being used to perform compile-time computation and macros |
21:37:53 | FromDiscord | <Phil> It is the "hidden" vm nim uses during compilation |
21:38:23 | FromDiscord | <Phil> It is also what basically enables nimscript to run, which is the subset of nim you write in `.nims` files for config purposes |
21:38:36 | FromDiscord | <Phil> So by itself it basically is already a complete feature with a clear purpose |
21:38:49 | FromDiscord | <Phil> (edit) removed "by itself" | removed "basically" |
21:39:44 | FromDiscord | <Nerve> So, not aimed at REPL-driven development, but if it works, it works, just don't expect support? |
21:40:07 | FromDiscord | <Nerve> (edit) "support?" => "support if it doesn't?" |
21:40:24 | FromDiscord | <Phil> It kind of can act like one, but if you want something that supports the full width of nim-libs you'll want to use inim |
21:40:53 | FromDiscord | <Phil> It isn't aimed to be a full REPL, it is aimed to be a script environment and for the compiler to use for compile-time stuff |
21:41:12 | FromDiscord | <Phil> And something that can act as a REPL for basic stuff is a side-effect of what it can do |
21:42:07 | FromDiscord | <Nerve> Looks like inim aims to exactly support what I'm looking for, awesome |
21:42:10 | FromDiscord | <Nerve> Thanks for the recommendation |
21:42:29 | FromDiscord | <auxym> @Nerve check out INim on nimble, works pretty well for me |
21:44:08 | FromDiscord | <Phil> In reply to @Nerve "Thanks for the recommendation": This isn't going to matter for like 95% of your stuff, but inim only kind of acts like a REPL, it isn't one under the hood.↵In actuality it adds the individual lines to a nim file, compiles it and prints the output of the latest statement back.↵That works really well, but also means if your file starts going really really really really really long your time until it reacts will go up |
21:45:04 | FromDiscord | <Phil> But due to this approach it also can also be used to write nim code just like you would in a project |
21:45:17 | FromDiscord | <Phil> (edit) removed "also" | "project" => "projec" |
21:45:20 | FromDiscord | <Phil> (edit) "projec" => "project" |
21:45:45 | FromDiscord | <Nerve> Huh. I would think incremental compilation would be a first-class feature of a compiled language that supports metaprogramming this strongly, seems like a natural fit. |
21:45:53 | FromDiscord | <ambient> notebooks are easy to convert to working program too, just saying |
21:46:17 | FromDiscord | <Phil> notebooks? |
21:46:33 | FromDiscord | <ambient> jupyter, it's basically the modern repl |
21:46:43 | FromDiscord | <Phil> Ohhhh you meant notebooks on the python side |
21:46:57 | FromDiscord | <ambient> nim works also on jupyter, it's not just python thing |
21:46:58 | FromDiscord | <Phil> I was like "Wait, we have a jupyter-alike on the nim end and I'm not aware of it?" |
21:47:05 | FromDiscord | <Phil> Huh |
21:47:17 | FromDiscord | <ambient> but like you said, it just builds a big file and compiles it |
21:48:06 | FromDiscord | <huantian> In reply to @Nerve "Huh. I would think": Eventually soon™️ |
21:48:16 | FromDiscord | <Gumbercules> In reply to @MadScientistCarl "OK, specifying directly through": I'm not on my PC but when I get on later I can help |
21:48:17 | FromDiscord | <huantian> It’s on the road map for Nim 2.x |
21:48:51 | FromDiscord | <Nerve> Neat™ |
21:48:58 | FromDiscord | <ambient> well incremental compilation does not mean that you can easily export and import the local environment of a program |
21:49:57 | FromDiscord | <Nerve> Yes, but sometimes just being able to compile a project, then drop into a repl so you can call modules and functions and refine new ones based on existing behavior is a godsend in and of itself |
21:50:21 | FromDiscord | <ambient> nothing prevents people from creating programs that manually (or through a macro) export and import the local environment |
21:52:23 | FromDiscord | <ambient> I don't know how easy it is to extract the local environment into a variable and move the entire thing between processes |
21:55:05 | FromDiscord | <ambient> maybe a custom pragma like {.notebook.} for variables or something like that |
22:08:18 | FromDiscord | <Elegantbeef> Where are your config files and what are their names?↵(@MadScientistCarl) |
22:25:30 | FromDiscord | <MadScientistCarl> I got it to work by pulling out the options from the function |
22:26:00 | FromDiscord | <MadScientistCarl> Finally found the documentation in the Nims page. This should be included in Nimble's doc |
22:37:41 | FromDiscord | <Saint> Does anyone use nim as a fast protoyping language or scripting language like they do with python? |
22:37:49 | FromDiscord | <Saint> I want to but having a hard time with the compile times |
22:37:58 | FromDiscord | <Saint> Rust has even slower compile times right? |
22:38:28 | FromDiscord | <Elegantbeef> I write many oneoff things in Nim |
22:38:34 | FromDiscord | <Elegantbeef> The compile times are hardly an issue |
22:45:44 | FromDiscord | <Elegantbeef> If you really want to minimise compile times you can install tcc and then do `nim c --cc:tcc -r ./myprogram.nim` |
22:46:04 | FromDiscord | <Elegantbeef> But really even with gcc or clang compile times for small programs are not substantial |
22:52:56 | FromDiscord | <Takemichi Hanagaki> In reply to @Saint "Does anyone use nim": I use it with NimScript. |
22:59:10 | FromDiscord | <Saint> Oh thanks I'll look into those |
22:59:25 | FromDiscord | <Saint> Is there a way to read a file line by line like in python |
22:59:43 | FromDiscord | <Saint> liek a for line in open('file.txt'): print(f) |
23:00:25 | FromDiscord | <Elegantbeef> There are multiple ways of doing it, the easiest is `for line in lines("file.txt"):...` |
23:02:07 | FromDiscord | <deeuu> sent a long message, see http://ix.io/4lnB |
23:03:31 | FromDiscord | <deeuu> (edit) "http://ix.io/4lnB" => "https://paste.rs/3te" |
23:04:00 | systemdsucks | mmap the file, iterate, profit |
23:07:23 | * | azimut_ quit (Ping timeout: 255 seconds) |
23:09:43 | * | azimut joined #nim |
23:39:50 | FromDiscord | <Saint> In reply to @Elegantbeef "There are multiple ways": Ty! |