<< 16-11-2026 >>

00:36:32*sdothum quit (Remote host closed the connection)
00:39:31*sdothum joined #nim
01:18:02*Mister_Magister quit (Quit: bye)
01:21:22*Mister_Magister joined #nim
01:59:53FromDiscord<toitle3554> In reply to @tempestro "I've recently tried messing": what?? that's one of the best features!
03:46:34FromDiscord<aaronspeedy> In reply to @mratsim "Generics don't work well": This doesn't need to be a generic
03:46:47FromDiscord<aaronspeedy> Or I mean monomorphized generics
03:47:08FromDiscord<aaronspeedy> Unions work just as well
03:48:00FromDiscord<aaronspeedy> An `Any` type can simply be implemented as a `void ` + a type indicator
03:48:33FromDiscord<aaronspeedy> (edit) "mean" => "mean: you don't have to use"
03:49:15FromDiscord<aaronspeedy> I've actually implemented my idea, by the way
03:49:23FromDiscord<aaronspeedy> https://control-core.com/tmp/star99
03:50:11FromDiscord<aaronspeedy> Implementation is LLM-slop so be aware, although it's not so aggregious because it's all in a single C99 file and you build it simply with `cc -std=c99 -O2 star99.c -lm -o star99`
04:15:03FromDiscord<aaronspeedy> It's to note that the language actually does not have generics
04:15:17FromDiscord<aaronspeedy> (edit) "It's to note that the language actually does not have ... generics" added "monomorphized"
04:15:27FromDiscord<aaronspeedy> You can implement it yourself extremely easily using metaprogramming
04:15:40FromDiscord<aaronspeedy> Takes like ten lines of code
04:15:49*SchweinDeBurg quit (Quit: WeeChat 4.8.0-dev)
04:27:55FromDiscord<aaronspeedy> https://media.discordapp.net/attachments/371759389889003532/1571743597831921715/image.png?ex=6afbd7cb&is=6afa864b&hm=8f81038bf2a777aaaab191cb9c889a757ec93ff26c611856fc39d88edf4af895&
04:28:49FromDiscord<aaronspeedy> It also has cool stuff like build hooks
04:28:51FromDiscord<aaronspeedy> https://media.discordapp.net/attachments/371759389889003532/1571743828660981760/image.png?ex=6afbd802&is=6afa8682&hm=7d1f2aacd3e9ec248f56056f9669be0a2d5a9019679b6d0a10fd230d3de383e9&
04:29:28FromDiscord<aaronspeedy> And it has built-in fuzzing support
04:29:29FromDiscord<aaronspeedy> https://media.discordapp.net/attachments/371759389889003532/1571743989411872819/image.png?ex=6afbd828&is=6afa86a8&hm=2214d1141bdd80b974a7943b21bd0aedb7e44b9b9711fa4eae2a3e81889cafe8&
04:38:09*SchweinDeBurg joined #nim
08:31:21*Jjp137 quit (Quit: Leaving)
08:36:05*insanescholar joined #nim
08:37:52*Jjp137 joined #nim
10:17:35FromDiscord<b0rsuk> In reply to @tempestro "I've recently tried messing": Wait, horrible? Why? They're described as `high performance bit vectors` in the tutorial.
10:21:50FromDiscord<tempestro> a bit vector set that can only take up to 16 bit data types is a highly specialised data structure really not suited for being the language's most basic set data type
10:26:10FromDiscord<tempestro> sent a long message, see https://paste.rs/er5hK
10:26:20FromDiscord<tempestro> (edit) "long message," => "code paste," | "https://paste.rs/qddZi" => "https://paste.rs/FYfv8"
10:36:02FromDiscord<tempestro> I would also prefer if you could just write `mySet + 24` instead of `mySet + {24}` for a union in an expression and having `+=` and `-=` be overloads for `incl` and `excl` by default
10:44:31FromDiscord<tempestro> basically, I think the built-in set and std's set should swap places, and some more QoL sugar would be nice, though I get the latter isn't really suitable for hardcore system architecture
11:30:12FromDiscord<b0rsuk> Speaking about the vibes, something I noticed after dabbling in Rust (completed Rustling twice and rewrote two small programs from Python and Go) compared to Nim:↵- Rust's documentation cares a lot about something living on stack or on the heap,↵- Nim's documentation cares a lot about the size of variables.
11:30:27FromDiscord<b0rsuk> (edit) "variables." => "data types."
11:30:40FromDiscord<b0rsuk> (edit) removed "the"
11:32:36FromDiscord<b0rsuk> In reply to @tempestro "I mean come on": I can barely use those sets from `system`. Sometimes they work, sometimes they don't and I haven't completely figured out yet. I need to re-read the documentation and practice.
11:32:58FromDiscord<b0rsuk> (edit) "In reply to @tempestro "I mean come on": I can barely use those sets from `system`. Sometimes they work, sometimes they don't and I haven't completely figured out ... yet." added "why"
13:28:58FromDiscord<janakali> sent a code paste, see https://paste.rs/Cecv4
13:30:44FromDiscord<janakali> also `mySet + 24` is an error in any sane language, because of a type system
14:38:57FromDiscord<b0rsuk> I have little experience with lower level languages.↵↵If `char` type has the size of 1 byte, and `array[0..x, char]` has the size `x 1` bytes... why does the `string` type has size 16 even if I make the string literal a lot longer than 16 characters?
14:43:24FromDiscord<amun0666> How did you get the size of 16?
14:43:43FromDiscord<b0rsuk> I guess it's more of a question of seq[char] vs array[char].
14:44:16FromDiscord<b0rsuk> In reply to @amun0666 "How did you get": echo sizeOf(string)
14:45:47FromDiscord<b0rsuk> Maybe 16 is the default allocated size, but it doesn't answer why a string literal is still size 16 when I make it a lot longer.
14:46:00FromDiscord<amun0666> sent a code paste, see https://paste.rs/HDWBK
14:47:03FromDiscord<amun0666> Which makes sense on 64-bit systems.
14:49:37FromDiscord<b0rsuk> sent a code paste, see https://paste.rs/zsarc
14:50:29FromDiscord<amun0666> I suspect the size depends on nim version. You shouldn't need getting a size of a string tbh.
14:50:39FromDiscord<amun0666> 2.4.0 here, 3x 8 bytes.
14:51:23FromDiscord<b0rsuk> I also use 2.4.0, installed via choosenim.
14:51:40FromDiscord<amun0666> Linux/amd64, custom .deb package made by /me.
14:52:33FromDiscord<b0rsuk> Debian amd64.
14:53:52FromDiscord<amun0666> I see it now. It returns 8 in VM mode (nim secret), 16 when in native one.
14:53:55FromDiscord<b0rsuk> No I don't need those sizes (yet), but I want to understand what data types are efficient and what's the relative difference. What price do I pay for fancier data types.
14:54:18FromDiscord<amun0666> string is a managed type, array is not.
14:54:43FromDiscord<amun0666> seq - see: string.
14:55:26FromDiscord<b0rsuk> So it's about stack vs heap.
14:55:40FromDiscord<amun0666> Mhm.
14:59:47FromDiscord<b0rsuk> 🤔 and the builtin sets may be fast, but also fat. 32 bytes.
15:01:23FromDiscord<amun0666> Depends on an inner type.
15:02:03FromDiscord<amun0666> I.e. you can't have a set of uint32.
15:52:16*insanescholar quit (Read error: Connection reset by peer)
16:37:26*Mister_Magister quit (Quit: bye)
16:39:43*Mister_Magister joined #nim
16:52:02FromDiscord<b0rsuk> 32-8192 bytes.
17:19:12FromDiscord<tempestro> sent a code paste, see https://paste.rs/3Br3v
17:22:44FromDiscord<Abdulrahman> In reply to @tempestro "bruh indeed If": Game character health (optimized)
17:23:18FromDiscord<Abdulrahman> Never did it btw
17:23:34FromDiscord<Abdulrahman> Who cares for the few bits saved
17:24:20FromDiscord<tempestro> In reply to @janakali "also `mySet + 24`": sure, I'll surround the number in curly braces, I love visual noise that carries no meaning↵When can you possibly mix up adding two numbers together and including a number in a set?
17:29:43FromDiscord<tempestro> In reply to @b0rsuk "I have little experience": Without looking at the manual or anything, I would expect a string to internally be a 4-byte length counter, 4-byte capacity counter, and 8-byte pointer to the data↵(I'm sure there's some super smart way to do it better, please don't stone me people)
17:30:22FromDiscord<tempestro> In reply to @abdulrahman.103 "Who cares for the": yeah exactly↵Don't bother with optimizations until you have benchmarked what about your program is actually slow
17:33:30FromDiscord<.astraea.san> In reply to @tempestro "sure, I'll surround the": it's not really visual noise if it creates a data structure, but how about just making your own proc +'s and such to do what you want?↵i don't see what the argument about preference is, people always made their own things for when standard language itself doesn't have it and this is not restricted to nim
17:35:00FromDiscord<.astraea.san> also your "when can you possibly mix up adding two numbers togrther and including a number in set" can be modified to apply just for everything and also for almost nothing, i think at some point we have to just stop somewhere
17:35:19FromDiscord<.astraea.san> (edit) "togrther" => "together"
17:36:35FromDiscord<tempestro> In reply to @b0rsuk "No I don't need": As far as I know, for a 64-bit processor, fetching 64 bits and 8 bits from memory is the same amount of work, the performance gains from using more compact data types actually come from taking up less cache (no idea if this is true for single values - it's definitely true when using arrays)↵↵Otherwise, for data structures like hash sets, that's theoretical informatics, you can prove the time
17:38:26FromDiscord<tempestro> In reply to @.astraea.san "it's not really visual": oh yeah, I totally agree↵I'm being pointlessly confrontational 😔
18:31:26*iwuvmika quit (Ping timeout: 247 seconds)
18:58:45*xtr00 joined #nim
19:25:44*iwuvmika joined #nim
21:01:29*iwuvmika quit (Ping timeout: 245 seconds)
21:42:10FromDiscord<b0rsuk> My perspective is that I come from Python and I want to know why lower level programming languages bother with more complicated ways of doing things. So don't tell me "performance doesn't matter", because if it really didn't we'd be all using Python (or something a bit more safe).
21:42:52FromDiscord<b0rsuk> (edit) "safe)." => "safe, because Python programs break at runtime pretty often)."
21:44:25FromDiscord<b0rsuk> Everyone draws the line at a bit different place too. The vibe I'm getting from Rust programmers is "we're not implementing this at all because it can't be done efficiently". For example they may default to a regular expression engine without backreferences at all, because backreferences are slow. I'm talking about `ripgrep`.
21:45:35FromDiscord<b0rsuk> For the record I didn't measure the performance of any of my Nim programs yet, so I clearly don't care about performance that much.
21:46:10*iwuvmika joined #nim
21:46:31FromDiscord<Abdulrahman> Its fast
21:46:33FromDiscord<b0rsuk> And I didn't notice any slowdown yet except for the program which calculates primes or something like that. I may actually used d:release for once.
21:46:33FromDiscord<Abdulrahman> No need
21:46:42FromDiscord<b0rsuk> (edit) "d:release" => "`d:release`"
21:47:02FromDiscord<b0rsuk> (edit) "used" => "use"
21:47:10FromDiscord<Abdulrahman> If its slow at something its the codes fault probably
21:47:36FromDiscord<Abdulrahman> In reply to @b0rsuk "And I didn't notice": Isnt calculating primes hard?
21:47:37FromDiscord<b0rsuk> Ok but it was my code. Programming exercise.
21:47:46FromDiscord<Abdulrahman> Like it requires lots of power
21:48:23FromDiscord<b0rsuk> In reply to @abdulrahman.103 "Isnt calculating primes hard?": It is. But there are dumber and smarter ways of doing this, and I would like to at least try a few before I reach for a library made by someone else.
21:49:39FromDiscord<Abdulrahman> About nim's speed, if done perfevtly correctly should match c, realistically a bit of runtime overhead exists especially in heap heavy applications
21:49:49FromDiscord<Abdulrahman> (edit) "perfevtly" => "perfectly"
21:50:45FromDiscord<Abdulrahman> Im currently making a library on top of sdl and the performance is very good
21:50:51FromDiscord<Abdulrahman> Its better than raylib
21:51:30FromDiscord<Abdulrahman> And 1 percent slower than my friends cpp sdl based lib,
21:51:42FromDiscord<Abdulrahman> Can be error margin tho
21:51:54FromDiscord<Abdulrahman> And his implementation might be better
21:51:56FromDiscord<b0rsuk> I learned a few things, such as `char` type uses radically less memory than string, and that's why lower level languages bother with it.
21:52:00FromDiscord<Abdulrahman> So take it with a grain of salt
21:52:28FromDiscord<Abdulrahman> In reply to @b0rsuk "I learned a few": Char is ascii string is utf8 i think
21:52:35FromDiscord<b0rsuk> For someone coming from Python, it's not obvious at all why you should try to use structs (tuples, objects...) rather than std/tables.
21:52:52FromDiscord<b0rsuk> But I suppose the main reason is compile time checks.
21:53:07FromDiscord<Abdulrahman> In nim 2 a string has a trailing zero
21:53:10FromDiscord<Abdulrahman> Like c
21:53:13FromDiscord<Abdulrahman> Thats 1 byte
21:53:15FromDiscord<b0rsuk> Imagine using std/tables everywhere. That's what Python teaches you to do.
21:53:36FromDiscord<Abdulrahman> In reply to @b0rsuk "For someone coming from": Different uses
21:53:59FromDiscord<Abdulrahman> I use tuple for return types with named fields
21:54:00FromDiscord<b0rsuk> It can change size at runtime too. That's not always relevant.
21:54:16FromDiscord<Abdulrahman> Objects for objects, like gui elements, colors, vectors, etc
21:54:35FromDiscord<Abdulrahman> I used tables to match font names to font cache
21:54:40FromDiscord<Abdulrahman> Yeah not the same use
21:55:01FromDiscord<Abdulrahman> Well
21:55:06FromDiscord<Abdulrahman> I can use objects for the cache thing
21:55:12FromDiscord<Abdulrahman> But it doesnt make sense
21:55:13FromDiscord<b0rsuk> I try to use more tuples in Python, because they're a little bit of extra protection against errors mostly, but Python syntax makes it harder. `[]` declares a dynamic list, but for a tuple you may need to use `tuple()`. So people often don't bother.
21:55:36FromDiscord<b0rsuk> Like when you're using a comprehension/generator expression and want the result to be a tuple.
21:55:38FromDiscord<Abdulrahman> I hate how everything in python is ineffecient so i dont care about optimization
21:56:06FromDiscord<Abdulrahman> Tuples are immutable, should be faster right? No significant difference
21:56:19FromDiscord<b0rsuk> In reply to @abdulrahman.103 "I hate how everything": I spent so much time in Python I don't fully understand the ways in which it's inefficient.
21:56:34FromDiscord<Abdulrahman> In python everything is an object
21:56:57FromDiscord<b0rsuk> But - considering how relatively resource hungry strings are (heap allocation etc) Python throwing strings around (and they're immutable) sounds like a big source of waste.
21:56:58FromDiscord<Abdulrahman> Ints arent c ints, variables arent typed variables, they are dynamic, thats an abstraction
21:57:16FromDiscord<b0rsuk> Why are Python strings immutable anyway? For error prevention, or performance?
21:57:26FromDiscord<Abdulrahman> Idk
21:57:42FromDiscord<Abdulrahman> Performance? Python doesnt care for that
21:57:48FromDiscord<Abdulrahman> Until recently
21:57:52Amun-Raperformance, memory optimization
21:57:57FromDiscord<Abdulrahman> Then they shut down the jit plan
21:58:20FromDiscord<b0rsuk> In reply to @abdulrahman.103 "Ints arent c ints,": Speaking of ints, how do Nim programmers usually deal with a variable that may get too large? An overflow? You never need to worry about this in Python because Python's ints are arbitrarily large.
21:58:45FromDiscord<Abdulrahman> I used to like python because it was easier than c, cpp and rust, then I found nim, python but fast, python but typed, python but less boring.
21:59:04FromDiscord<Abdulrahman> In reply to @b0rsuk "Speaking of ints, how": You use a custom bigint type
21:59:18FromDiscord<b0rsuk> For example when using Python you're solving the "grains on a chessboard" classic puzzle and wondering what the fuss is about. But when writing Nim, it turns out the number of grains on the 64th square is exactly uint64.high
21:59:27FromDiscord<b0rsuk> So you need to be careful how you're dealing with it.
21:59:29Amun-Rayes, overflow
21:59:55FromDiscord<Abdulrahman> Signed ints error if they overflow↵Unsigned wrap around
22:00:00FromDiscord<Abdulrahman> Take these 2 into considerations
22:00:12FromDiscord<Abdulrahman> Why do unsigned not error?
22:00:20FromDiscord<b0rsuk> In reply to @abdulrahman.103 "You use a custom": But it doesn't matter in practice unless you're dealing with a third party sending stuff over a network? Who may try to overwhelm your server?
22:00:51FromDiscord<Abdulrahman> In reply to @b0rsuk "But it doesn't matter": I never even encountered a situation where 32 bits arent enough
22:01:12FromDiscord<b0rsuk> In reply to @abdulrahman.103 "Signed ints error if": Sounds like it's usually not a good idea to use unsigned ints. Not worth the pain in the butt.
22:01:52Amun-Rathat depends
22:02:04FromDiscord<b0rsuk> In reply to @abdulrahman.103 "I used to like": I understand the other points but why is Python boring?
22:02:44FromDiscord<b0rsuk> I think for a lot of Python programmers coming to Nim the reason is aesthetics. We're a bit petty like this.
22:02:59FromDiscord<Abdulrahman> In reply to @b0rsuk "I understand the other": It is fun, but i like nims ufcs and i like making types, in python making types is slightly more of a big decision classes init etc
22:03:03FromDiscord<b0rsuk> It's the lack of braces and semicolons.
22:03:18FromDiscord<Abdulrahman> Also i like overloading
22:03:24FromDiscord<Abdulrahman> These are fun
22:03:45FromDiscord<Abdulrahman> In reply to @b0rsuk "I think for a": Thats exactly why i came
22:03:51Amun-RaI mostly write nim nowadays, I have to keep in mind not to write "x = y and z" in python
22:03:55FromDiscord<b0rsuk> Oh yes ufcs is a joy to work with, you get method-like syntax by default. And you can also have a getter this way if you want.
22:04:28FromDiscord<Abdulrahman> Yeah i just made a color.r .g .b .a getter with procs
22:04:35FromDiscord<Abdulrahman> Was very fun
22:05:05FromDiscord<b0rsuk> In reply to @abdulrahman.103 "Thats exactly why i": And also a reason why it repels many C (and similar) programmers. They assume it sucks because it looks... too clean I guess.
22:05:09FromDiscord<Abdulrahman> I hope that one day we have a big project that makes nim more main stream
22:05:18FromDiscord<Abdulrahman> (edit) "main stream" => "mainstream"
22:05:44FromDiscord<Abdulrahman> In reply to @b0rsuk "And also a reason": Yeah
22:05:50FromDiscord<Abdulrahman> I have a friend who codes in cpp
22:05:56FromDiscord<Abdulrahman> He cant code in any simple lang
22:06:03FromDiscord<b0rsuk> In reply to @abdulrahman.103 "Also i like overloading": Rust doesn't have default function values 🤦🏻‍♂️
22:06:03FromDiscord<Abdulrahman> Simple as in simple syntax
22:06:18FromDiscord<Abdulrahman> Really?
22:06:21FromDiscord<Abdulrahman> How
22:06:37FromDiscord<Abdulrahman> Thats very important
22:06:42FromDiscord<b0rsuk> Last time I tried it it didn't.
22:07:09FromDiscord<Abdulrahman> Yeah youre righti
22:07:12FromDiscord<Abdulrahman> I just searched
22:07:14FromDiscord<b0rsuk> In reply to @abdulrahman.103 "Thats very important": It forces many extremely similar functions with the same name but different signature (different arguments).
22:07:24FromDiscord<Abdulrahman> So overloading
22:07:44FromDiscord<b0rsuk> Nim has overloading for different data types, but Rust has like 3x more overloading.
22:08:01FromDiscord<b0rsuk> Because of no default argument values
22:08:09FromDiscord<Abdulrahman> Overloading just for a default parameter is wasted time
22:08:18FromDiscord<Abdulrahman> And ugly codebase
22:08:22FromDiscord<Abdulrahman> I cant read rust
22:08:24FromDiscord<Abdulrahman> My eyes hurt
22:14:35FromDiscord<b0rsuk> In reply to @abdulrahman.103 "And ugly codebase": I'm sure there are more outrageous examples, but here's some idea. They need to write separate `RangeFrom`, `RangeTo` and so on because the language doesn't allow procs/funcs with default values. https://doc.rust-lang.org/std/range/index.html
22:14:47FromDiscord<b0rsuk> (edit) "some idea." => "a small sample."
22:15:13FromDiscord<b0rsuk> I haven't used it in a long time so I can't come up with something from memory.
22:15:25*om3ga quit (Ping timeout: 250 seconds)
22:17:44FromDiscord<aaronspeedy> In reply to @abdulrahman.103 "Overloading just for a": Also for the compiler, I think
22:18:12FromDiscord<aaronspeedy> Haven't measured it but it makes sense
22:19:10FromDiscord<b0rsuk> In any case, I remember scrolling through a looong, loong list of very similar functions somewhere in Rust standard library.
22:19:17FromDiscord<aaronspeedy> Oh ...
22:19:30FromDiscord<aaronspeedy> I was about to correct myself and call myself retarded
22:19:35FromDiscord<aaronspeedy> But I guess I'm not
22:20:16FromDiscord<gesee37> In reply to @abdulrahman.103 "Overloading just for a": I think it's faster (and easier) to implement default params as overload instead or some rewrite rules (atleast I know nim overload for default arguments, way easier to reason about them that way)
22:20:36FromDiscord<gesee37> (edit) "or" => "of"
22:21:14FromDiscord<aaronspeedy> You don't need rewrite rules though, right?
22:21:38FromDiscord<aaronspeedy> Just treat it the same as not specifying that argument
22:21:55FromDiscord<aaronspeedy> Similar to how in structs often you don't set 90% of the fields
22:22:23FromDiscord<gesee37> Yeah, I made a typo in my message
22:26:06*om3ga joined #nim
22:44:05*iwuvmika_ joined #nim
22:44:37*iwuvmika quit (Ping timeout: 261 seconds)
22:48:02*iwuvmika_ is now known as iwuvmika
23:00:51*rockcavera joined #nim
23:22:30*greaser|q quit (Quit: HYDRA IRC LOL)